this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Might as well do cid+did+rkey then for a composite key

alice cba8b8dd 3ab65bde

+7 -5
+7 -5
packages/backend/src/lib/emojiStats.ts
··· 104 104 langs: post.langs, 105 105 })), 106 106 ) 107 - .returning(['id', 'rkey']) 107 + .returning(['id', 'cid', 'did', 'rkey']) 108 108 .execute(); 109 109 110 - // Map rkey to id 111 - const rkeyToIdMap = new Map<string, number>(); 110 + // Map composite key to id 111 + const compositeKeyToIdMap = new Map<string, number>(); 112 112 insertedPosts.forEach((post) => { 113 - rkeyToIdMap.set(post.rkey, post.id); 113 + const compositeKey = `${post.cid}-${post.did}-${post.rkey}`; 114 + compositeKeyToIdMap.set(compositeKey, post.id); 114 115 }); 115 116 116 117 // Prepare bulk insert for emojis 117 118 const emojiInserts: { post_id: number; emoji: string; lang: string }[] = []; 118 119 currentBatch.forEach((post) => { 119 120 if (post.hasEmojis) { 120 - const postId = rkeyToIdMap.get(post.rkey); 121 + const compositeKey = `${post.cid}-${post.did}-${post.rkey}`; 122 + const postId = compositeKeyToIdMap.get(compositeKey); 121 123 if (postId) { 122 124 post.emojis.forEach((emoji) => { 123 125 post.langs.forEach((lang) => {