Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(baking): bake graphers in parallel, using multiple db transactions #3539

Merged
merged 1 commit into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions baker/GrapherBaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,14 @@ export const bakeAllChangedGrapherPagesVariablesPngSvgAndDeleteRemovedGraphers =
await pMap(
jobs,
async (job) => {
// TODO: not sure if the shared transaction will be an issue - I think it should be fine but just to put a flag here
// that this could be causing issues
await bakeSingleGrapherChart(job, knex)
// We want to run this code on multiple threads, so we need to
// be able to use multiple transactions so that we can use
// multiple connections to the database.
// Read-write consistency is not a concern here, thankfully.
await db.knexReadWriteTransaction(
async (knex) => await bakeSingleGrapherChart(job, knex),
db.TransactionCloseMode.KeepOpen
)
progressBar.tick({ name: `slug ${job.slug}` })
},
{ concurrency: 10 }
Expand Down
Loading