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.ranks = {};
|
||||
this.updateRanking();
|
||||
setInterval(this.updateRanking, 5 * MINUTE);
|
||||
DailyCron.hook(this.resetDailyRanking);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import etag from 'etag';
|
|||
import forceGC from './core/forceGC';
|
||||
import assets from './assets.json'; // eslint-disable-line import/no-unresolved
|
||||
import logger from './core/logger';
|
||||
import rankings from './core/ranking';
|
||||
import models from './data/models';
|
||||
|
||||
import {
|
||||
|
@ -166,6 +167,7 @@ app.get('/', async (req, res) => {
|
|||
const promise = models.sync().catch((err) => logger.error(err.stack));
|
||||
promise.then(() => {
|
||||
server.listen(PORT, () => {
|
||||
rankings.updateRanking();
|
||||
const address = server.address();
|
||||
logger.log('info', `web is running at http://localhost:${address.port}/`);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user