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

Merge branch 'main' into feat/feed-generator

+14 -3
+14 -3
apps/api/src/scripts/sync.ts
··· 138 138 139 139 for (const { scrobble } of records) { 140 140 console.log(`Syncing scrobble ${chalk.cyan(scrobble.id)} ...`); 141 - await publishScrobble(ctx, scrobble.id); 141 + try { 142 + await publishScrobble(ctx, scrobble.id); 143 + } catch (err) { 144 + console.error( 145 + `Failed to sync scrobble ${chalk.cyan(scrobble.id)}:`, 146 + err 147 + ); 148 + } 142 149 } 143 150 } 144 151 process.exit(0); ··· 156 163 .innerJoin(users, eq(scrobbles.userId, users.id)) 157 164 .where(or(eq(users.did, arg), eq(users.handle, arg))) 158 165 .orderBy(desc(scrobbles.createdAt)) 159 - .limit(process.env.SYNC_SIZE ? parseInt(process.env.SYNC_SIZE) : 20); 166 + .limit(process.env.SYNC_SIZE ? parseInt(process.env.SYNC_SIZE, 10) : 20); 160 167 161 168 for (const { scrobble } of records) { 162 169 console.log(`Syncing scrobble ${chalk.cyan(scrobble.id)} ...`); 163 - await publishScrobble(ctx, scrobble.id); 170 + try { 171 + await publishScrobble(ctx, scrobble.id); 172 + } catch (err) { 173 + console.error(`Failed to sync scrobble ${chalk.cyan(scrobble.id)}:`, err); 174 + } 164 175 } 165 176 console.log(`Synced ${chalk.greenBright(records.length)} scrobbles`); 166 177 }