-
Notifications
You must be signed in to change notification settings - Fork 536
MergeResources concurrent call return 429 #5029
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
base: main
Are you sure you want to change the base?
Conversation
cf421f3
to
3549127
Compare
catch (Exception ex) | ||
{ | ||
_logger.LogError(ex, "Unexpected error in SQL adaptive throttling sampling loop."); | ||
} |
Check notice
Code scanning / CodeQL
Generic catch clause
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 1 day ago
To fix the issue, replace the generic catch (Exception ex)
block with specific catch blocks for anticipated exceptions, such as TaskCanceledException
and other exceptions that are expected in this context. For unexpected exceptions, rethrow them after logging to ensure they are not silently swallowed. This ensures that only known issues are handled, while unexpected ones are propagated for proper handling.
-
Copy modified lines R97-R100 -
Copy modified line R104
@@ -96,2 +96,6 @@ | ||
} | ||
catch (SqlException sqlEx) | ||
{ | ||
_logger.LogError(sqlEx, "SQL error in adaptive throttling sampling loop."); | ||
} | ||
catch (Exception ex) | ||
@@ -99,2 +103,3 @@ | ||
_logger.LogError(ex, "Unexpected error in SQL adaptive throttling sampling loop."); | ||
throw; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!!
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
} | ||
|
||
/// <summary> | ||
/// Periodically samples the recent success and rejection rates of SQL merge resource transactions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently checks are happening on each call to merge stored procedure. This logic performs. Why is it not that simple as to return 429 on every failed for correct reason call?
Description
Raise 429 errors if MergeResources concurrent calls is above optimal. Also add retryAfter header to suggest the backoff.
Related issues
Addresses [issue #].
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)