Compare commits
2 Commits
6d1c7eb3c5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
027ca59a01 | ||
|
|
9d0af3289a |
@@ -491,10 +491,14 @@ async function processSchedulesForDiocese(
|
||||
})),
|
||||
});
|
||||
|
||||
// Mark church as scraped
|
||||
// Update church metadata from detail (pastor, phone) if available
|
||||
const churchUpdateData: Record<string, unknown> = { lastScrapedAt: new Date() };
|
||||
if (detail.parroco) churchUpdateData.pastorName = detail.parroco;
|
||||
if (detail.telefono) churchUpdateData.phone = detail.telefono;
|
||||
|
||||
await tx.church.update({
|
||||
where: { id: dbId },
|
||||
data: { lastScrapedAt: new Date() },
|
||||
data: churchUpdateData,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ async function main() {
|
||||
console.log(`🔄 Incremental filter: updatedAt > ${transferSince.toISOString()}\n`);
|
||||
}
|
||||
|
||||
const BATCH_SIZE = 200;
|
||||
const BATCH_SIZE = 100;
|
||||
const totalCount = await nasPrisma.church.count({ where: whereClause });
|
||||
|
||||
console.log(`Found ${totalCount} enriched churches (will process in batches of ${BATCH_SIZE})\n`);
|
||||
@@ -270,6 +270,9 @@ async function main() {
|
||||
console.error(`Error transferring ${church.name}:`, error instanceof Error ? error.message : error);
|
||||
}
|
||||
}
|
||||
|
||||
// Brief pause between batches to avoid overwhelming Neon
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
} // end batch loop
|
||||
|
||||
console.log('\n════════════════════════════════════════════════════════════');
|
||||
|
||||
Reference in New Issue
Block a user