eventlog: fix cleanup

This commit is contained in:
Girish Ramakrishnan
2021-06-05 21:20:32 -07:00
parent 579c046944
commit eb16e8a8ee
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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
});
+1 -1
View File
@@ -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 ]);