feat: delay onboarding during high load (CM-775) #3609
Merged
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.
This pull request introduces a system safeguard to prevent overloading during periods of high activity by limiting repository onboarding based on the number of integration results. The main changes include adding a new configuration setting, implementing a load-checking function, and updating repository acquisition logic to respect system load.
System Load Management and Onboarding Control:
MAX_INTEGRATION_RESULTS, to configure the maximum allowed number of integration results before onboarding is paused. (services/apps/git_integration/src/crowdgit/settings.py)MAX_INTEGRATION_RESULTSincrud.pyto make the setting available for onboarding logic. (services/apps/git_integration/src/crowdgit/database/crud.py)Repository Processing Logic Improvements:
can_onboard_more()async function to check if the current count of integration results is below the configured limit, returningFalseif the database is under high load or the query fails. (services/apps/git_integration/src/crowdgit/database/crud.py)acquire_repo_for_processing()to prioritize onboarding only when system load allows, falling back to recurrent repositories if onboarding is skipped due to high activity. Added documentation to clarify the new priority logic. (services/apps/git_integration/src/crowdgit/database/crud.py)