-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make shard lease Release block in PostStop
#7383
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.
Self-review
|
|
||
| try | ||
| { | ||
| ReleaseLease().GetAwaiter().GetResult(); |
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.
Actual fix, we block instead of running Release() in a detached task.
|
|
||
| return; | ||
|
|
||
| async Task ReleaseLease() |
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.
Code modernization, refactor ContinueWith to internal method
| TryLoadRememberedEntities(); | ||
| return true; | ||
|
|
||
| case LeaseAcquireResult lar when !lar.Acquired && lar.Reason == null: |
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.
Code removed and simplified, ILoggingAdaptor.Error can accept null exception, this code is not needed.
| Acquire().PipeTo(self); | ||
| return; | ||
|
|
||
| async Task<LeaseAcquireResult> Acquire() |
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.
Code modernization, refactor ContinueWith to internal method
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.
LGTM
| } | ||
| catch | ||
| { | ||
| // no-op, we're shutting down anyway. |
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.
Might want to log an Exception here just in case
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.
Ah NM - you do it down below
Fixes #7379
Changes
ShardcodeRelease()in PostStop instead of doing a detached task. This should be save becauseLeaseis required to have a per operation timeout limit.Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):