From 3a2a876f745bd717df659416a43878572f7ae1f4 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 29 Oct 2024 14:11:30 +0000 Subject: [PATCH] fix player scores background refreshing --- projects/backend/src/index.ts | 2 +- projects/backend/src/service/player.service.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/backend/src/index.ts b/projects/backend/src/index.ts index 3b31985..6cef4b0 100644 --- a/projects/backend/src/index.ts +++ b/projects/backend/src/index.ts @@ -75,7 +75,7 @@ app.use( app.use( cron({ name: "player-scores-tracker-cron", - pattern: "0 4 * * *", // Every day at 04:00 + pattern: "*/1 * * * *", // Every day at 04:00 timezone: "Europe/London", // UTC time protect: true, run: async () => { diff --git a/projects/backend/src/service/player.service.ts b/projects/backend/src/service/player.service.ts index 649bfc3..89eeaca 100644 --- a/projects/backend/src/service/player.service.ts +++ b/projects/backend/src/service/player.service.ts @@ -264,6 +264,7 @@ export class PlayerService { * @private */ private static async refreshPlayerScoreSaberScores(player: PlayerDocument) { + console.log(player); console.log(`Refreshing scores for ${player.id}...`); let page = 1; let hasMorePages = true; @@ -324,7 +325,7 @@ export class PlayerService { console.log(`Found ${players.length} players to refresh.`); for (const player of players) { - await this.refreshAllPlayerScores(player.id); + await this.refreshAllPlayerScores(player); await delay(SCORESABER_REQUEST_COOLDOWN); // Cooldown between players } }