force track players bc it never ran
All checks were successful
Deploy Backend / deploy (push) Successful in 3m2s
All checks were successful
Deploy Backend / deploy (push) Successful in 3m2s
This commit is contained in:
parent
82116a7405
commit
d5cc35da05
@ -99,6 +99,11 @@ app.use(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start cronjobs
|
||||||
|
*/
|
||||||
|
PlayerService.initCronjobs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swagger Documentation
|
* Swagger Documentation
|
||||||
*/
|
*/
|
||||||
@ -108,9 +113,4 @@ app.onStart(() => {
|
|||||||
console.log("Listening on port http://localhost:8080");
|
console.log("Listening on port http://localhost:8080");
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Start cronjobs
|
|
||||||
*/
|
|
||||||
PlayerService.initCronjobs();
|
|
||||||
|
|
||||||
app.listen(8080);
|
app.listen(8080);
|
||||||
|
@ -12,15 +12,26 @@ export class PlayerService {
|
|||||||
* Initialize the cron jobs
|
* Initialize the cron jobs
|
||||||
*/
|
*/
|
||||||
public static initCronjobs() {
|
public static initCronjobs() {
|
||||||
|
(async () => {
|
||||||
|
console.log("Tracking player statistics...");
|
||||||
|
const players: PlayerDocument[] = await PlayerModel.find({});
|
||||||
|
for (const player of players) {
|
||||||
|
await PlayerService.trackScoreSaberPlayer(getMidnightAlignedDate(new Date()), player);
|
||||||
|
}
|
||||||
|
console.log("Finished tracking player statistics.");
|
||||||
|
})();
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
cron({
|
cron({
|
||||||
name: "player-statistics-tracker-cron",
|
name: "player-statistics-tracker-cron",
|
||||||
pattern: "0 1 * * *", // Every day at 00:01 (midnight)
|
pattern: "0 1 * * *", // Every day at 00:01 (midnight)
|
||||||
run: async () => {
|
run: async () => {
|
||||||
|
console.log("Tracking player statistics...");
|
||||||
const players: PlayerDocument[] = await PlayerModel.find({});
|
const players: PlayerDocument[] = await PlayerModel.find({});
|
||||||
for (const player of players) {
|
for (const player of players) {
|
||||||
await PlayerService.trackScoreSaberPlayer(getMidnightAlignedDate(new Date()), player);
|
await PlayerService.trackScoreSaberPlayer(getMidnightAlignedDate(new Date()), player);
|
||||||
}
|
}
|
||||||
|
console.log("Finished tracking player statistics.");
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user