feat: optimize db queries (#297)

This commit is contained in:
Julian Tölle 2023-09-17 00:31:39 +02:00 committed by GitHub
parent fd28daa37a
commit dd57a52ab6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 104 additions and 33 deletions

View file

@ -53,7 +53,7 @@ export class SchedulerService implements OnApplicationBootstrap {
const INACTIVE_CUTOFF_MSEC = 60 * 60 * 1000;
await Promise.all(
userInfo.map(({ user, lastListen }) => {
userInfo.map(({ userID, lastListen }) => {
let pollRate = POLL_RATE_INACTIVE_SEC;
const timeSinceLastListen = new Date().getTime() - lastListen.getTime();
@ -62,10 +62,10 @@ export class SchedulerService implements OnApplicationBootstrap {
}
this.importSpotifyJobService.sendThrottled(
{ userID: user.id },
{ userID },
{},
pollRate,
user.id,
userID,
);
}),
);