fix player scores background refreshing
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 52s

This commit is contained in:
Lee 2024-10-29 14:11:30 +00:00
parent a26bf53996
commit 3a2a876f74
2 changed files with 3 additions and 2 deletions

View File

@ -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 () => {

View File

@ -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
}
}