fix: limit queue cleanup to expired users
This commit is contained in:
+2
-2
@@ -236,8 +236,8 @@ class Appv2 {
|
||||
const afterFetchFromDb = Date.now();
|
||||
console.log("Fetch from db: "+(Date.now() - startTimeToDebug) / 1000 + " seconds");
|
||||
|
||||
for (const user of users) {
|
||||
const storage = new storageObj(user.id);
|
||||
for (const userId of userToDel) {
|
||||
const storage = new storageObj(userId);
|
||||
await storage.removeQueue();
|
||||
count++;
|
||||
}
|
||||
|
||||
+3
-1
@@ -55,7 +55,9 @@ class Storage {
|
||||
try {
|
||||
await fsp.unlink(this.fileName);
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
if (err?.code !== 'ENOENT') {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
this.dbObj.deleteUser(this.userId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user