Repository navigation
Conversation
feywind
added this pull request to stack #9467
October 15, 2026 19:01
This was referenced Oct 15, 2026
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive unit tests for publish hedging in message queues, refactors existing tests to use async/await, and adds tests to verify that pubsub.request correctly handles aborted signals. The review feedback highlights critical runtime ReferenceErrors in the new tests due to missing namespace qualifiers on Queue and OrderedQueue, and recommends replacing the generic Function type with a more specific callback signature in the pubsub tests.
feywind
marked this pull request as ready for review
October 15, 2026 21:33
This was referenced Oct 15, 2026
feywind
force-pushed
the
pubsub/hedging-queue-unit-tests
branch
from
October 19, 2026 21:57
83ff0a2 to
52924b1
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR is Layer 6 of 7 in Stack #9467, which implements Publish Hedging for
@google-cloud/pubsubto mitigate high-percentile (p99/p99.9) publish tail latencies by sending backup (hedged) publish RPCs when an in-flight batch takes longer than a configurablehedgeDelaythreshold.Stack Structure
feat(gax): support AbortSignal cancellation in CallOptions and createApiCallfeat(pubsub): add HedgingOptions validation and HedgingTokenBucketfeat(pubsub): add CancellationSharer and HedgingSchedulerfeat(pubsub): add OpenTelemetry events and logging for hedged publishfeat(pubsub): integrate publish hedging into MessageQueuetest(pubsub): add unit tests for publish hedging queue integration(this PR)test(pubsub): add publish hedging system testsSummary of Changes in This PR
This layer adds unit test coverage for the publish hedging queue integration and
AbortSignalhandling inPubSub.prototype.request:handwritten/pubsub/test/publisher/message-queues.ts:attempt 0) winning after a hedged attempt is dispatched, aborting the hedged attempt viaAbortSignaland recordingpublish end.attempt 0and recordingpublish end (hedged).attempt 0succeeds.attempt 0rejecting the batch and aborting any in-flight hedged attempts.attempt 1,attempt 2, ...) athedgeDelayintervals.'Hedging rate limited due to lack of tokens.') and token replenishment over subsequent successful publishes.OrderedQueuenever hedges.handwritten/pubsub/test/pubsub.ts:AbortSignalbeforegetClient_completes andAbortSignalaborted whilegetClient_is in flight.