refactor: use bulk increment

This commit is contained in:
Barış Soner Uşaklı
2025-04-03 11:53:48 -04:00
parent dd3d1917d1
commit 667367a68f

View File

@@ -24,10 +24,11 @@ Errors.writeData = async function () {
return; return;
} }
const bulkIncrement = [];
for (const key of keys) { for (const key of keys) {
/* eslint-disable no-await-in-loop */ bulkIncrement.push(['errors:404', _counters[key], key ]);
await db.sortedSetIncrBy('errors:404', _counters[key], key);
} }
await db.sortedSetIncrByBulk(bulkIncrement);
} catch (err) { } catch (err) {
winston.error(err.stack); winston.error(err.stack);
} }