diff --git a/src/cron.js b/src/cron.js index bdf9bb5f6..cbea5eed5 100644 --- a/src/cron.js +++ b/src/cron.js @@ -101,7 +101,7 @@ function startJobs(callback) { gJobs.cleanupEventlog = new CronJob({ cronTime: '00 */30 * * * *', // every 30 minutes - onTick: eventlog.cleanup, + onTick: eventlog.cleanup.bind(null, new Date(Date.now() - 60 * 60 * 24 * 10 * 1000)), // 10 days ago start: true }); diff --git a/src/eventlog.js b/src/eventlog.js index f632f96ca..1ca070d9a 100644 --- a/src/eventlog.js +++ b/src/eventlog.js @@ -179,7 +179,7 @@ async function getAllPaged(actions, search, page, perPage) { async function cleanup(options) { assert.strictEqual(typeof options, 'object'); - const creationTime = options.creationTime || new Date(Date.now() - 60 * 60 * 24 * 10 * 1000); // 10 days ago + const creationTime = options.creationTime; const results = await database.query('SELECT * FROM eventlog WHERE creationTime <= ?', [ creationTime ]);