diff --git a/server/lib/rdio-scanner/controller.js b/server/lib/rdio-scanner/controller.js index 975fc6f..ec9c563 100644 --- a/server/lib/rdio-scanner/controller.js +++ b/server/lib/rdio-scanner/controller.js @@ -50,11 +50,26 @@ class Controller { this.ffmpeg = !spawnSync('ffmpeg', ['-version']).error; - this.pruneInterval = undefined; - if (!this.ffmpeg) { 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) { @@ -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) { const scope = this.getScope(apiKey, this.app.config.apiKeys);