fix(pubsub): update Flush to not block the Publisher#4823
fix(pubsub): update Flush to not block the Publisher#4823PhongChuong merged 1 commit intogoogleapis:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4823 +/- ##
==========================================
- Coverage 94.97% 94.96% -0.02%
==========================================
Files 205 205
Lines 8059 8059
==========================================
- Hits 7654 7653 -1
- Misses 405 406 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
suzmue
left a comment
There was a problem hiding this comment.
nit on description, should be fixes
Does this fix the bug? I would think there would need to be changes to the batch actors as well to make it "not block".
|
@suzmue , I've updated the PR description. See if that explains scenario better. If not, can you describe the scenario that you have in mind? |
Ok sounds good. The scenario I am thinking of is when we are doing concurrent publishes (no ordering keys), the batcher is blocked waiting for those flush operations to complete: google-cloud-rust/src/pubsub/src/publisher/actor.rs Lines 270 to 275 in 36a50c6 |
|
For your described scenario, we first need to discuss and clarify the behavior for Flush as defined [here] ( google-cloud-rust/src/pubsub/src/publisher/client.rs Lines 93 to 108 in aaa316f
Does flush_2 returning guarantee that all previous publish are complete (both publish_[1, 2])? Or just up to the previous Flush (just publish_2)? I'll add a tracking issue and/or fix it in a following PR after the discussion. |
The Publisher currently blocks on a Flush operation to complete across all ordering keys before additional operations can be processed. For example during a Flush operation, when ordering key A Flush is complete and ordering key B is still pending, the Publisher will not process new operations for A until after B's Flush is complete.
This PR updates the Publisher to spawn a task to await on all the Flush operations instead of blocking the main Dispatcher loop. This allows the Publisher to dispatch new operations to the ordering key actors without awaiting for all keys Flush to complete. In the example above, new operations for A will make process. We are guarantee correct ordering because the ToBatchActor::Flush has been sent to each batch actors.
Fixes #4505