Skip to content

feat(pubsub): integrate publish hedging into AsyncPublisher and Service - #36641

Draft
feywind wants to merge 1 commit into
hedging/coordinator-and-schedulerfrom
hedging/queue-integration
Draft

feywind wants to merge 1 commit into
hedging/coordinator-and-schedulerfrom
hedging/queue-integration

Conversation

@feywind

@feywind feywind commented Oct 16, 2026 •

Copy link
Copy Markdown

Stack Structure (Stack #36644)

Layer Branch PR
1 hedging/options-and-token-bucket #36639
2 hedging/coordinator-and-scheduler #36640
3 hedging/queue-integration #36641 (this PR)
4 hedging/queue-unit-tests #36642
5 hedging/system-tests #36643

Summary

Implements Layer 3 of Cloud Pub/Sub Publish Hedging (go/sdk:pubsub-hedging) for google-cloud-pubsub:

  • TopicAdmin::CancellableRetryPolicy & TopicAdmin::Client operation hook (lib/google/cloud/pubsub/admin_clients.rb):
    • Registers active gRPC Operation instances with the thread-bound AttemptHandle so losing attempts can be cancelled mid-flight via Operation#cancel.
    • Prevents Gapic::ServiceStub::RpcCall from retrying GRPC::Cancelled when an attempt was intentionally cancelled, and uses AttemptHandle#sleep_interruptibly during retry backoff so attempt 0 wakes immediately on sibling completion.
  • Service#publish & Service#publish_timeout (lib/google/cloud/pubsub/service.rb):
    • Adds call_options: and attempt_handle: support to Service#publish while preserving 1-arg publish_internal(request) compatibility when options are omitted.
  • AsyncPublisher & Publisher integration (lib/google/cloud/pubsub/async_publisher.rb, lib/google/cloud/pubsub/publisher.rb):
    • Wires hedging: configuration into AsyncPublisher#initialize and Publisher, enforces mutual exclusion in enable_message_ordering!, dispatches unordered batches through CancellationSharer and HedgingScheduler, and tears down hedging resources cleanly in wait!.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant