do not update rankings too soon, it causes database errors if models aren't synced yet
This commit is contained in:
parent
c41d650008
commit
7a84ad7684
|
@ -18,7 +18,6 @@ class Ranks {
|
||||||
this.resetDailyRanking = this.resetDailyRanking.bind(this);
|
this.resetDailyRanking = this.resetDailyRanking.bind(this);
|
||||||
|
|
||||||
this.ranks = {};
|
this.ranks = {};
|
||||||
this.updateRanking();
|
|
||||||
setInterval(this.updateRanking, 5 * MINUTE);
|
setInterval(this.updateRanking, 5 * MINUTE);
|
||||||
DailyCron.hook(this.resetDailyRanking);
|
DailyCron.hook(this.resetDailyRanking);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import etag from 'etag';
|
||||||
import forceGC from './core/forceGC';
|
import forceGC from './core/forceGC';
|
||||||
import assets from './assets.json'; // eslint-disable-line import/no-unresolved
|
import assets from './assets.json'; // eslint-disable-line import/no-unresolved
|
||||||
import logger from './core/logger';
|
import logger from './core/logger';
|
||||||
|
import rankings from './core/ranking';
|
||||||
import models from './data/models';
|
import models from './data/models';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -166,6 +167,7 @@ app.get('/', async (req, res) => {
|
||||||
const promise = models.sync().catch((err) => logger.error(err.stack));
|
const promise = models.sync().catch((err) => logger.error(err.stack));
|
||||||
promise.then(() => {
|
promise.then(() => {
|
||||||
server.listen(PORT, () => {
|
server.listen(PORT, () => {
|
||||||
|
rankings.updateRanking();
|
||||||
const address = server.address();
|
const address = server.address();
|
||||||
logger.log('info', `web is running at http://localhost:${address.port}/`);
|
logger.log('info', `web is running at http://localhost:${address.port}/`);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user