32427 Update reserve corps logic to resolve db lock issue and other perf tweaks for migrating batches larger than 10K with migration filter on#4078
Merged
argush3 merged 2 commits intobcgov:mainfrom Feb 12, 2026
Conversation
…erf tweaks for migrating batches larger than 10K with migration filter on
Rajandeep98
approved these changes
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #: /bcgov/entity#32427
Description of changes:
Fixes tombstone flow getting “stuck reserving 1000 corps” by making reservation/count logic match the actual filtered cohort and by optimizing the reservable selection query for end-of-batch performance.
Key Changes
Impact
Reservation time remains stable as the cohort drains, scheduled runs stop hammering reservation when exhausted, and affiliate-related aggregation work is avoided when not required.
Test Notes
Able to run migrate 10k businesses with following setup locally in around 11 minutes
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).