Fixed cron timer
This commit is contained in:
@@ -8,7 +8,7 @@ let CronJob = require('cron').CronJob;
|
|||||||
let { log } = require('../common/utilities.js');
|
let { log } = require('../common/utilities.js');
|
||||||
|
|
||||||
const runDailyDiagnostics = (connection) => {
|
const runDailyDiagnostics = (connection) => {
|
||||||
let dailyJob = new CronJob('0 0 * * * *', () => {
|
let dailyJob = new CronJob('0 0 0 * * *', () => {
|
||||||
let query = 'INSERT INTO diagnostics (playerCount, returnedPlayerCount, totalGold, totalRecruitments, totalDeaths, totalCombats) VALUES ((SELECT COUNT(*) FROM profiles), (SELECT COUNT(*) FROM profiles WHERE (recruits + soldiers + spies + scientists) >= 2), (SELECT SUM(gold) FROM profiles), (IFNULL((SELECT SUM(quantity) FROM diagnosticsEvents WHERE eventName = "recruit"), 0)), (IFNULL((SELECT SUM(quantity) FROM diagnosticsEvents WHERE eventName = "death"), 0)), (SELECT COUNT(*) FROM pastCombat WHERE eventTime >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)));';
|
let query = 'INSERT INTO diagnostics (playerCount, returnedPlayerCount, totalGold, totalRecruitments, totalDeaths, totalCombats) VALUES ((SELECT COUNT(*) FROM profiles), (SELECT COUNT(*) FROM profiles WHERE (recruits + soldiers + spies + scientists) >= 2), (SELECT SUM(gold) FROM profiles), (IFNULL((SELECT SUM(quantity) FROM diagnosticsEvents WHERE eventName = "recruit"), 0)), (IFNULL((SELECT SUM(quantity) FROM diagnosticsEvents WHERE eventName = "death"), 0)), (SELECT COUNT(*) FROM pastCombat WHERE eventTime >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)));';
|
||||||
connection.query(query, (err) => {
|
connection.query(query, (err) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|||||||
Reference in New Issue
Block a user