Use config.ts for state TTL
This commit is contained in:
parent
52583c4e32
commit
56dc20abff
|
@ -1,3 +1,3 @@
|
||||||
export default {
|
export default {
|
||||||
StateTTL: 5 * 60 * 1000
|
StateTTL: 0.25 * 60 * 1000
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Level } from 'level';
|
import { Level } from 'level';
|
||||||
import { ExporterState, PartialStateUpdate, Status } from './index';
|
import { ExporterState, PartialStateUpdate, Status } from './index';
|
||||||
|
import Config from '../config';
|
||||||
const FIVE_MINUTES = 0.25 * 60 * 1000;
|
|
||||||
|
|
||||||
type LevelError = Error | null | undefined;
|
type LevelError = Error | null | undefined;
|
||||||
|
|
||||||
|
@ -43,8 +42,8 @@ class LevelState {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async prepTTL() {
|
private async prepTTL() {
|
||||||
console.info("Will clear state in 5 minutes");
|
console.info(`Will clear state in ${Config.StateTTL} milliseconds`);
|
||||||
this.currentTTLHandle = window.setTimeout(async () => await this.clear(), FIVE_MINUTES);
|
this.currentTTLHandle = window.setTimeout(async () => await this.clear(), Config.StateTTL);
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(stateUpdate: ExporterState | PartialStateUpdate): Promise<ExporterState> {
|
async update(stateUpdate: ExporterState | PartialStateUpdate): Promise<ExporterState> {
|
||||||
|
|
Loading…
Reference in New Issue