clean state cache in 30 seconds

This commit is contained in:
2020-01-14 17:03:14 +08:00
parent f06a6f4e78
commit 790c95ffc3
2 changed files with 16 additions and 9 deletions

View File

@ -11,5 +11,12 @@ export class Caches {
setState(name: string, content: string) {
this._state = content;
logger.info(`State (${name}) recieved. To load it: some_var = new Extractor().load()`);
// clear cache in 30 seconds
setTimeout(() => {
if (this._state) {
logger.info(`Uploaded state is cleaned after 30 second.`);
this._state = "";
}
}, 30000);
}
}