Reset daily stats @ midnight, duh
This commit is contained in:
@@ -953,6 +953,10 @@ function getDefaultConfig() {
|
||||
eventScheduler : {
|
||||
|
||||
events : {
|
||||
resetDailyStats : {
|
||||
schedule : 'at 12:00:01am', // note: Later.js places this right @ midnight
|
||||
action : '@method:core/misc_scheduled_events.js:resetDailyStatsScheduledEvent',
|
||||
},
|
||||
trimMessageAreas : {
|
||||
// may optionally use [or ]@watch:/path/to/file
|
||||
schedule : 'every 24 hours',
|
||||
|
||||
18
core/misc_scheduled_events.js
Normal file
18
core/misc_scheduled_events.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
const StatLog = require('./stat_log.js');
|
||||
const SysProps = require('./system_property.js');
|
||||
|
||||
exports.resetDailyStatsScheduledEvent = resetDailyStatsScheduledEvent;
|
||||
|
||||
function resetDailyStatsScheduledEvent(args, cb) {
|
||||
//
|
||||
// Various stats need reset daily
|
||||
//
|
||||
[ SysProps.LoginsToday, SysProps.MessagesToday ].forEach(prop => {
|
||||
StatLog.setNonPersistentSystemStat(prop, 0);
|
||||
});
|
||||
|
||||
return cb(null);
|
||||
}
|
||||
Reference in New Issue
Block a user