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;
}
const bulkIncrement = [];
for (const key of keys) {
/* eslint-disable no-await-in-loop */
await db.sortedSetIncrBy('errors:404', _counters[key], key);
bulkIncrement.push(['errors:404', _counters[key], key ]);
}
await db.sortedSetIncrByBulk(bulkIncrement);
} catch (err) {
winston.error(err.stack);
}