Fix: Improve release year migration reliability (retry on restart, better logging, slower rate limit)
This commit is contained in:
@@ -8,10 +8,9 @@ echo "Running database migrations..."
|
||||
npx prisma migrate deploy
|
||||
|
||||
# Run release year migration (only if not already done)
|
||||
if [ ! -f /app/.release-years-migrated ]; then
|
||||
echo "Running release year migration (this will take ~12 seconds for 600 songs)..."
|
||||
# Run release year migration (idempotent, skips if all done)
|
||||
echo "Running release year migration check..."
|
||||
node scripts/migrate-release-years.mjs
|
||||
fi
|
||||
|
||||
# Start the application
|
||||
echo "Starting application..."
|
||||
|
||||
@@ -12,7 +12,7 @@ const prisma = new PrismaClient();
|
||||
|
||||
const MUSICBRAINZ_API_BASE = 'https://musicbrainz.org/ws/2';
|
||||
const USER_AGENT = 'hoerdle/0.1.0 ( elpatron@mailbox.org )';
|
||||
const RATE_LIMIT_DELAY = 25; // 25ms between requests
|
||||
const RATE_LIMIT_DELAY = 100; // 100ms between requests (conservative)
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
@@ -149,7 +149,7 @@ async function migrate() {
|
||||
// console.log(` ✅ Updated with year: ${releaseYear}`);
|
||||
} else {
|
||||
failed++;
|
||||
// console.log(` ⚠️ No release year found`);
|
||||
console.log(` ⚠️ No release year found for "${song.title}" by "${song.artist}"`);
|
||||
}
|
||||
} catch (error) {
|
||||
failed++;
|
||||
|
||||
Reference in New Issue
Block a user