mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
Fix prune scheduler not being started
This commit is contained in:
parent
2a14073911
commit
4256457f2d
|
|
@ -50,11 +50,26 @@ class Controller {
|
||||||
|
|
||||||
this.ffmpeg = !spawnSync('ffmpeg', ['-version']).error;
|
this.ffmpeg = !spawnSync('ffmpeg', ['-version']).error;
|
||||||
|
|
||||||
this.pruneInterval = undefined;
|
|
||||||
|
|
||||||
if (!this.ffmpeg) {
|
if (!this.ffmpeg) {
|
||||||
console.warn('ffmpeg is missing, no audio conversion possible.');
|
console.warn('ffmpeg is missing, no audio conversion possible.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.app.config.pruneDays > 0) {
|
||||||
|
this.pruneInterval = setInterval(() => {
|
||||||
|
const now = new Date();
|
||||||
|
|
||||||
|
this.app.models.call.destroy({
|
||||||
|
where: {
|
||||||
|
dateTime: {
|
||||||
|
[Op.lt]: new Date(now.getFullYear(), now.getMonth(), now.getDate() - this.app.config.pruneDays),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}, 15 * 60 * 1000);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.pruneInterval = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticate(token) {
|
authenticate(token) {
|
||||||
|
|
@ -512,30 +527,6 @@ class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pruneSchedulerStart() {
|
|
||||||
if (this.app.config.pruneDays > 0) {
|
|
||||||
this.pruneInterval = setInterval(() => {
|
|
||||||
const now = new Date();
|
|
||||||
|
|
||||||
this.app.models.call.destroy({
|
|
||||||
where: {
|
|
||||||
dateTime: {
|
|
||||||
[Op.lt]: new Date(now.getFullYear(), now.getMonth(), now.getDate() - this.app.config.pruneDays),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, 15 * 60 * 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pruneSchedulerStop() {
|
|
||||||
if (this.pruneInterval) {
|
|
||||||
clearInterval(this.pruneInterval);
|
|
||||||
|
|
||||||
this.pruneInterval = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
validateApiKey(apiKey, system, talkgroup) {
|
validateApiKey(apiKey, system, talkgroup) {
|
||||||
const scope = this.getScope(apiKey, this.app.config.apiKeys);
|
const scope = this.getScope(apiKey, this.app.config.apiKeys);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue