-
Notifications
You must be signed in to change notification settings - Fork 368
Implement exponential backoff with jitter for retry logic in TeamsUtility methods #4896
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
Conversation
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.
Pull Request Overview
This pull request improves the retry mechanism for team provisioning by implementing exponential backoff with jitter in the TeamsUtility methods.
- Added exponential backoff logic with configurable retry limits and initial backoff durations.
- Incorporated random jitter into delay calculations to reduce retry collisions.
// Initial backoff time in seconds | ||
const int initialBackoffSeconds = 5; | ||
|
||
while (wait && iterations < maxRetries) |
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.
[nitpick] The two retry loops use different maxRetries values (12 in the first block, 10 in the second). Verify whether this difference is intended or if a consistent retry limit should be applied.
Copilot uses AI. Check for mistakes.
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.
Pull Request Overview
This PR improves the retry mechanism for Teams provisioning by implementing exponential backoff with jitter in two retry loops.
- Implements exponential backoff with configurable initial delay and maximum retries for group creation.
- Introduces a new retry loop with backoff and jitter for updating team settings.
Comments suppressed due to low confidence (1)
src/Commands/Utilities/TeamsUtility.cs:165
- [nitpick] Consider using a consistent naming convention for the retry iteration variable across both retry loops (e.g., using 'retryCount' instead of 'iterations') to improve code clarity.
while (wait && iterations < maxRetries)
catch | ||
{ |
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.
[nitpick] Consider explicitly catching Exception (e.g., 'catch (Exception ex)') to enhance clarity and facilitate debugging or logging in the future.
catch | |
{ | |
catch (Exception ex) | |
{ | |
// Log the exception details for debugging | |
Console.WriteLine($"Exception occurred: {ex.Message}"); | |
Console.WriteLine($"Stack Trace: {ex.StackTrace}"); |
Copilot uses AI. Check for mistakes.
Type
Related Issues?
Fixes #4757
What is in this Pull Request ?
Improve retry mechanism for teams provisioning