Skip to content

Commit

Permalink
feat(config): make report generation interval configurable PE-5451
Browse files Browse the repository at this point in the history
Makes the report generation interval configurable via the
REPORT_GENERATION_INTERVAL_MS environment variable.
  • Loading branch information
djwhitt committed Jan 19, 2024
1 parent 689ae6e commit a60bb85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,8 @@ export const SUBMIT_CONTRACT_INTERACTIONS =
env.varOrDefault('SUBMIT_CONTRACT_INTERACTIONS', 'false') === 'true';

export const WARP_LOG_LEVEL = env.varOrDefault('WARP_LOG_LEVEL', 'fatal');

export const REPORT_GENERATION_INTERVAL_MS = +env.varOrDefault(
'REPORT_GENERATION_INTERVAL_MS',
`${1000 * 60 * 60}`, // 1 hour
);
4 changes: 1 addition & 3 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ import log from './log.js';
import { app } from './server.js';
import { updateAndSaveCurrentReport } from './system.js';

const REPORT_GENERATION_INTERVAL_MS = 1000 * 60 * 60; // 1 hour

if (config.RUN_OBSERVER) {
setInterval(updateAndSaveCurrentReport, REPORT_GENERATION_INTERVAL_MS);
setInterval(updateAndSaveCurrentReport, config.REPORT_GENERATION_INTERVAL_MS);

app.listen(config.PORT, () => {
log.info(`Listening on port ${config.PORT}`);
Expand Down

0 comments on commit a60bb85

Please sign in to comment.