A decentralized music tracking and discovery platform built on AT Protocol 🎵
listenbrainz spotify atproto lastfm musicbrainz scrobbling

Log batch progress and simplify conflict handling

Changed files
+9 -3
apps
cli
src
cmd
+9 -3
apps/cli/src/cmd/sync.ts
··· 340 340 341 341 for (let i = 0; i < validSongData.length; i += BATCH_SIZE) { 342 342 const batch = validSongData.slice(i, i + BATCH_SIZE); 343 + const batchNumber = Math.floor(i / BATCH_SIZE) + 1; 344 + const totalBatches = Math.ceil(validSongData.length / BATCH_SIZE); 345 + 346 + logger.info`▶️ Processing tracks batch ${batchNumber}/${totalBatches} (${Math.min(i + BATCH_SIZE, validSongData.length)}/${validSongData.length})`; 343 347 344 348 ctx.db.transaction((tx) => { 345 349 const tracks = tx ··· 371 375 artistUri: artist.uri, 372 376 })), 373 377 ) 374 - .onConflictDoNothing({ 375 - target: schema.tracks.cid, 376 - }) 378 + .onConflictDoNothing() 377 379 .returning() 378 380 .all(); 379 381 ··· 476 478 477 479 for (let i = 0; i < validScrobbleData.length; i += BATCH_SIZE) { 478 480 const batch = validScrobbleData.slice(i, i + BATCH_SIZE); 481 + const batchNumber = Math.floor(i / BATCH_SIZE) + 1; 482 + const totalBatches = Math.ceil(validScrobbleData.length / BATCH_SIZE); 483 + 484 + logger.info`🕒 Processing scrobbles batch ${batchNumber}/${totalBatches} (${Math.min(i + BATCH_SIZE, validScrobbleData.length)}/${validScrobbleData.length})`; 479 485 480 486 const result = await ctx.db 481 487 .insert(schema.scrobbles)