refactor: setObjectBulk to match sortedSetAddBulk

This commit is contained in:
Barış Soner Uşaklı
2021-11-12 19:51:59 -05:00
parent 1a85aaad23
commit 8379c11b22
13 changed files with 75 additions and 82 deletions

View File

@@ -124,5 +124,5 @@ async function updateUserLastposttimes(uids, topicsData) {
async function shiftPostTimes(tid, timestamp) {
const pids = (await posts.getPidsFromSet(`tid:${tid}:posts`, 0, -1, false));
// Leaving other related score values intact, since they reflect post order correctly, and it seems that's good enough
return db.setObjectBulk(pids.map(pid => `post:${pid}`), pids.map((_, idx) => ({ timestamp: timestamp + idx + 1 })));
return db.setObjectBulk(pids.map((pid, idx) => [`post:${pid}`, { timestamp: timestamp + idx + 1 }]));
}