mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	refactor: use getSortedSetUnion in syncUserInboxes instead
This commit is contained in:
		| @@ -319,12 +319,15 @@ Notes.syncUserInboxes = async function (tid) { | |||||||
| 	]); | 	]); | ||||||
| 	pids.unshift(mainPid); | 	pids.unshift(mainPid); | ||||||
|  |  | ||||||
| 	const recipients = await db.getSetsMembers(pids.map(id => `post:${id}:recipients`)); | 	const uids = await db.getSortedSetUnion({ | ||||||
| 	const uids = recipients.reduce((set, uids) => new Set([...set, ...uids.map(u => parseInt(u, 10))]), new Set()); | 		sets: pids.map(id => `post:${id}:recipients`), | ||||||
| 	const keys = Array.from(uids).map(uid => `uid:${uid}:inbox`); | 		start: 0, | ||||||
|  | 		stop: -1, | ||||||
|  | 	}); | ||||||
|  | 	const keys = uids.map(uid => `uid:${uid}:inbox`); | ||||||
| 	const score = await db.sortedSetScore(`cid:${cid}:tids`, tid); | 	const score = await db.sortedSetScore(`cid:${cid}:tids`, tid); | ||||||
|  |  | ||||||
| 	winston.verbose(`[activitypub/syncUserInboxes] Syncing tid ${tid} with ${uids.size} inboxes`); | 	winston.verbose(`[activitypub/syncUserInboxes] Syncing tid ${tid} with ${uids.length} inboxes`); | ||||||
| 	await db.sortedSetsAdd(keys, keys.map(() => score || Date.now()), tid); | 	await db.sortedSetsAdd(keys, keys.map(() => score || Date.now()), tid); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user