async function incrementBatchCounter(redis, batchId, field) { const key = `batch:${batchId}`; let result = null; while (result === null) { await redis.watch(key); const multi = redis.multi(); multi.hincrby(key, field, 1); multi.hincrby(key, 'processed', 1); // Returns null if WATCH key was modified by another client result = await multi.exec(); } } __ __