Skip to content

Commit

Permalink
add force option
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Moschkin committed Dec 6, 2023
1 parent fad56d3 commit 92a1f2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/logic/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export async function loadStats() {
return {};
}

export async function createStats() {
export async function createStats(force?: boolean) {
let mynow = new Date();
let path = `${process.env.PROFILE_DATA_PATH}/stats`;
if (!fs.existsSync(path)) {
Expand All @@ -89,7 +89,7 @@ export async function createStats() {

if (fs.existsSync(dailyfile)) {
let rt = fs.statSync(dailyfile);
if (rt.mtime.getDay() !== (mynow.getDay())) {
if (force || rt.mtime.getDay() !== (mynow.getDay())) {
fs.rmSync(dailyfile);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion app/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (process.argv.length > 2) {
port = parseInt(process.argv[2]);
}

setTimeout(() => createStats());
setTimeout(() => createStats(true));

let nocache = (req: Request, res: Response, next: any) => {
res.setHeader('Surrogate-Control', 'no-store');
Expand Down

0 comments on commit 92a1f2a

Please sign in to comment.