perf: single db call to add all uids

v1.18.x
Barış Soner Uşaklı 4 years ago
parent a5fa212fc7
commit 90d5c9da44

@ -140,11 +140,11 @@ Digest.send = async function (data) {
interval: data.interval,
showUnsubscribe: true,
}).catch(err => winston.error(`[user/jobs] Could not send digest email\n[emailer.send] ${err.stack}`));
}));
if (data.interval !== 'alltime') {
await db.sortedSetAdd('digest:delivery', now.getTime(), userObj.uid);
const now = Date.now();
await db.sortedSetAdd('digest:delivery', userData.map(() => now), userData.map(u => u.uid));
}
}));
}, {
interval: 1000,
batch: 100,

Loading…
Cancel
Save