fix: addressed issue with count doubling (#2518)

This commit is contained in:
Wyatt Johnson
2019-09-04 17:33:42 -04:00
committed by Kim Gardner
parent ac1ed45e4b
commit 0fad1070a6
@@ -106,8 +106,10 @@ export async function recalculateSharedModerationQueueQueueCounts(
// Increment the hash key values.
const pipeline = redis.pipeline();
// Mark the key as fresh, and update the values!
pipeline.mhincrby(
// Mark the key as fresh, and update the values! We're using `HMSET` here
// because this can still result in race conditions when the call is made
// twice.
pipeline.hmset(
key,
...queues.reduce((acc, queue) => [...acc, queue._id, queue.total], [])
);