eventlog: fix cleanup
This commit is contained in:
+1
-1
@@ -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
@@ -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 ]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user