feat(generator): use async for long-running operations#6830
feat(generator): use async for long-running operations#6830coryan merged 2 commits intogoogleapis:mainfrom
Conversation
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Codecov Report
@@ Coverage Diff @@
## main #6830 +/- ##
==========================================
- Coverage 95.04% 95.04% -0.01%
==========================================
Files 1264 1264
Lines 113316 113312 -4
==========================================
- Hits 107697 107693 -4
Misses 5619 5619
Continue to review full report at Codecov.
|
d2dceef to
b95a7cb
Compare
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
For long-running operations we need to generate three different RPCs: one to start the operation (e.g. `CreateDatabase()`), one to poll the operation (`GetOperation()`), and one to cancel the operation (`CancelOperation()`). With this change all the three RPCs are generated as asynchronous RPCs. The `*Connection` class can use these asynchronous RPCs in the background, using the background threads. This (1) avoids creating a detached thread to poll the operation, (2) uses code that is more easily unit tested separate from the generated libraries.
b95a7cb to
145830a
Compare
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
For long-running operations we need to generate three different RPCs:
one to start the operation (e.g.
CreateDatabase()), one to poll theoperation (
GetOperation()), and one to cancel the operation(
CancelOperation()). With this change all the three RPCs aregenerated as asynchronous RPCs.
The
*Connectionclass can use these asynchronous RPCs in thebackground, using the background threads. This (1) avoids creating a
detached thread to poll the operation, (2) uses code that is more easily
unit tested separate from the generated libraries.
Fixes #6821
This change is