fix player scores background refreshing
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 52s
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 52s
This commit is contained in:
parent
a26bf53996
commit
3a2a876f74
@ -75,7 +75,7 @@ app.use(
|
|||||||
app.use(
|
app.use(
|
||||||
cron({
|
cron({
|
||||||
name: "player-scores-tracker-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
|
timezone: "Europe/London", // UTC time
|
||||||
protect: true,
|
protect: true,
|
||||||
run: async () => {
|
run: async () => {
|
||||||
|
@ -264,6 +264,7 @@ export class PlayerService {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private static async refreshPlayerScoreSaberScores(player: PlayerDocument) {
|
private static async refreshPlayerScoreSaberScores(player: PlayerDocument) {
|
||||||
|
console.log(player);
|
||||||
console.log(`Refreshing scores for ${player.id}...`);
|
console.log(`Refreshing scores for ${player.id}...`);
|
||||||
let page = 1;
|
let page = 1;
|
||||||
let hasMorePages = true;
|
let hasMorePages = true;
|
||||||
@ -324,7 +325,7 @@ export class PlayerService {
|
|||||||
console.log(`Found ${players.length} players to refresh.`);
|
console.log(`Found ${players.length} players to refresh.`);
|
||||||
|
|
||||||
for (const player of players) {
|
for (const player of players) {
|
||||||
await this.refreshAllPlayerScores(player.id);
|
await this.refreshAllPlayerScores(player);
|
||||||
await delay(SCORESABER_REQUEST_COOLDOWN); // Cooldown between players
|
await delay(SCORESABER_REQUEST_COOLDOWN); // Cooldown between players
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user