refactor: single remove call

v1.18.x
Barış Soner Uşaklı 4 years ago
parent ab11435ed5
commit 25ab99b91d

@ -327,10 +327,9 @@ Notifications.prune = async function () {
]); ]);
await batch.processSortedSet('users:joindate', async function (uids) { await batch.processSortedSet('users:joindate', async function (uids) {
await Promise.all([ const unread = uids.map(uid => 'uid:' + uid + ':notifications:unread');
db.sortedSetsRemoveRangeByScore(uids.map(uid => 'uid:' + uid + ':notifications:unread'), '-inf', cutoffTime), const read = uids.map(uid => 'uid:' + uid + ':notifications:read');
db.sortedSetsRemoveRangeByScore(uids.map(uid => 'uid:' + uid + ':notifications:read'), '-inf', cutoffTime), db.sortedSetsRemoveRangeByScore(unread.concat(read), '-inf', cutoffTime);
]);
}, { batch: 500, interval: 100 }); }, { batch: 500, interval: 100 });
} catch (err) { } catch (err) {
if (err) { if (err) {

Loading…
Cancel
Save