|
|
@ -13,7 +13,7 @@ module.exports = {
|
|
|
|
await batch.processSortedSet('topics:tid', async (tids) => {
|
|
|
|
await batch.processSortedSet('topics:tid', async (tids) => {
|
|
|
|
const keys = tids.map(tid => `topic:${tid}:thumbs`);
|
|
|
|
const keys = tids.map(tid => `topic:${tid}:thumbs`);
|
|
|
|
const counts = await db.sortedSetsCard(keys);
|
|
|
|
const counts = await db.sortedSetsCard(keys);
|
|
|
|
const tidToCount = _.zip(tids, counts);
|
|
|
|
const tidToCount = _.zipObject(tids, counts);
|
|
|
|
const tidsWithThumbs = tids.filter((t, i) => counts[i] > 0);
|
|
|
|
const tidsWithThumbs = tids.filter((t, i) => counts[i] > 0);
|
|
|
|
await db.setObjectBulk(
|
|
|
|
await db.setObjectBulk(
|
|
|
|
tidsWithThumbs.map(tid => `topic:${tid}`),
|
|
|
|
tidsWithThumbs.map(tid => `topic:${tid}`),
|
|
|
|