This commit is contained in:
NoLogicAlan committed 2026-05-28 17:40:18 +03:00
1 parent 9e363c9ccf
commit 5a29545d41
14 files changed
+116 -50

No files matched your search

+9
View File
@@ -91,6 +91,7 @@ export class LastFmManager {
this._hasBotIdColumn = false;
this._userCache = new Map();
this._userCacheMax = 5000;
this._totalScrobblesCache = null;
this._totalScrobblesCacheExpiry = 0;
@@ -263,6 +264,10 @@ export class LastFmManager {
scrobbleEnabled: !!row.scrobble,
};
this._userCache.set(userId, data);
while (this._userCache.size > this._userCacheMax) {
const oldestKey = this._userCache.keys().next().value;
this._userCache.delete(oldestKey);
}
return data;
}
@@ -277,6 +282,10 @@ export class LastFmManager {
);
const data = { sessionKey, username: username ?? "", scrobbleEnabled: true };
this._userCache.set(userId, data);
while (this._userCache.size > this._userCacheMax) {
const oldestKey = this._userCache.keys().next().value;
this._userCache.delete(oldestKey);
}
try {
await pool.execute(