A decentralized music tracking and discovery platform built on AT Protocol 🎵
0
fork

Configure Feed

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

fix collections script

+13 -5
+13 -5
apps/api/src/scripts/collections.ts
··· 175 175 .limit(1) 176 176 .execute(), 177 177 ]); 178 - let [newScroble] = await ctx.db 178 + let [newScrobble] = await ctx.db 179 179 .insert(schema.scrobbles) 180 180 .values({ 181 181 albumId: album.id, ··· 191 191 .execute(); 192 192 193 193 try { 194 - if (!newScroble) { 195 - [newScroble] = await ctx.db 194 + if (!newScrobble) { 195 + [newScrobble] = await ctx.db 196 196 .select() 197 197 .from(schema.scrobbles) 198 198 .where(eq(schema.scrobbles.uri, scrobble.uri)) 199 199 .limit(1) 200 200 .execute(); 201 201 } 202 - await publishScrobble(ctx, newScroble.id); 202 + if (!newScrobble) { 203 + consola.warn( 204 + `Scrobble not found after conflict for ${chalk.cyan(value.title)} ${chalk.yellow( 205 + scrobble.uri, 206 + )} — skipping publish`, 207 + ); 208 + return; 209 + } 210 + await publishScrobble(ctx, newScrobble.id); 203 211 } catch (err) { 204 212 consola.error( 205 - `Failed to sync scrobble ${chalk.cyan(newScroble.id)}:`, 213 + `Failed to sync scrobble ${chalk.cyan(newScrobble.id)}:`, 206 214 err, 207 215 ); 208 216 }