diff --git a/src/config.ts b/src/config.ts index cd0fdc9..2d7659f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,3 +1,3 @@ export default { - StateTTL: 5 * 60 * 1000 + StateTTL: 0.25 * 60 * 1000 } diff --git a/src/state/level.ts b/src/state/level.ts index 7033d03..7c14f24 100644 --- a/src/state/level.ts +++ b/src/state/level.ts @@ -1,7 +1,6 @@ import { Level } from 'level'; import { ExporterState, PartialStateUpdate, Status } from './index'; - -const FIVE_MINUTES = 0.25 * 60 * 1000; +import Config from '../config'; type LevelError = Error | null | undefined; @@ -43,8 +42,8 @@ class LevelState { } private async prepTTL() { - console.info("Will clear state in 5 minutes"); - this.currentTTLHandle = window.setTimeout(async () => await this.clear(), FIVE_MINUTES); + console.info(`Will clear state in ${Config.StateTTL} milliseconds`); + this.currentTTLHandle = window.setTimeout(async () => await this.clear(), Config.StateTTL); } async update(stateUpdate: ExporterState | PartialStateUpdate): Promise {