-
Notifications
You must be signed in to change notification settings - Fork 388
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
fix(common): revamp the async polling loop #7762
Conversation
* Do not drop a cancellation request made before we receive the `longrunning::Operation`. Instead, remember that a cancellation request was made, and then cancel the operation once we know it has started. This (probabilistically) saves a significant chunk of time in the `spanner_cancel_backup_create` sample, as we now always cancel the `CreateBackup()`. * Do not fabricate a cancelled `Status`. The only way we really know an operation has been cancelled is by examining the `GetOperation()` response.
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Codecov Report
@@ Coverage Diff @@
## main #7762 +/- ##
==========================================
- Coverage 95.15% 95.15% -0.01%
==========================================
Files 1271 1271
Lines 114603 114633 +30
==========================================
+ Hits 109054 109082 +28
- Misses 5549 5551 +2
Continue to review full report at Codecov.
|
Do not fabricate a deadline-exceeded `Status` when the polling policy says enough is enough. That left the operation in an unknowable state. Rather, cancel the operation and wait for the next poll to yield us an accurate status (which may end up being OK). That is, a polling limit is really a request for auto-cancellation. (See googleapis#7762 for the part-un work on ensuring an explicit cancel yielded an accurate status.) In the case of the Spanner backup tests, for example, this means we can do something meaningful after hitting the poll limit of a `CreateBackup()` call, as we'll know that the backup is no longer pending. Update the poll-loop mocking tests to account for the new sequence of RPCs.
Do not fabricate a deadline-exceeded `Status` when the polling policy says enough is enough. That left the operation in an unknowable state. Rather, cancel the operation and wait for the next poll to yield us an accurate status (which may end up being OK). That is, a polling limit is really a request for auto-cancellation. (See googleapis#7762 for the part-un work on ensuring an explicit cancel yielded an accurate status.) In the case of the Spanner backup tests, for example, this means we can do something meaningful after hitting the poll limit of a `CreateBackup()` call, as we'll know that the backup is no longer pending. Update the poll-loop mocking tests to account for the new sequence of RPCs.
Do not fabricate a deadline-exceeded `Status` when the polling policy says enough is enough. That left the operation in an unknowable state. Rather, cancel the operation and wait for the next poll to yield us an accurate status (which may end up being OK). That is, a polling limit is really a request for auto-cancellation. (See googleapis#7762 for the part-un work on ensuring an explicit cancel yielded an accurate status.) In the case of the Spanner backup tests, for example, this means we can do something meaningful after hitting the poll limit of a `CreateBackup()` call, as we'll know that the backup is no longer pending. Update the poll-loop mocking tests to account for the new sequence of RPCs.
Do not drop a cancellation request made before we receive
the
longrunning::Operation
.Instead, remember that a cancellation request was made,
and then cancel the operation once we know it has started.
This (probabilistically) saves a significant chunk of time
in the
spanner_cancel_backup_create
sample, as we nowalways cancel the
CreateBackup()
.Do not fabricate a cancelled
Status
.The only way we really know an operation has been cancelled
is by examining the
GetOperation()
response.This change is