Repository navigation
fix(pubsub): pause underlying pull streams and skip keepalive teardown while paused - #9521
Merged
Merged
Conversation
…n while paused - Propagate MessageStream.pause() and resume() to underlying StreamingPull gRPC streams (including newly replaced streams while paused) and clear pending keepalive timeout timers on pause. - Skip setting or triggering the 15s server keepalive timeout timer while MessageStream is paused, while continuing to send client keepalive writes. - Guard against undefined or empty receivedMessages in Subscriber._onData().
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces pause and resume capabilities to the MessageStream class, ensuring that underlying StreamingPull streams and keepalive timers respect the paused state. Additionally, it adds safety checks to the Subscriber class to handle empty keepalive responses that lack receivedMessages. Unit tests have been added to verify these behaviors. There are no review comments, so I have no feedback to provide.
quirogas
approved these changes
Oct 6, 2026
Merged
shivanee-p
added a commit
that referenced
this pull request
Oct 7, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>google-gax: 6.12.0</summary> ## [6.12.0](google-gax-v6.11.1...google-gax-v6.12.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>gaxios: 8.2.0</summary> ## [8.2.0](gaxios-v8.1.0...gaxios-v8.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>gcp-metadata: 9.1.0</summary> ## [9.1.0](gcp-metadata-v9.0.4...gcp-metadata-v9.1.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>google-auth-library: 11.2.0</summary> ## [11.2.0](google-auth-library-v11.1.0...google-auth-library-v11.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>googleapis-common: 9.2.0</summary> ## [9.2.0](googleapis-common-v9.1.0...googleapis-common-v9.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>test-utils: 0.2.1</summary> ## [0.2.1](test-utils-v0.2.0...test-utils-v0.2.1) (2026-10-07) ### Bug Fixes * **test-utils:** Make google-test-utils a private workspace package ([#9525](#9525)) ([be25b6f](be25b6f)) </details> <details><summary>bigquery: 9.2.0</summary> ## [9.2.0](bigquery-v9.1.0...bigquery-v9.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>bigtable: 7.4.0</summary> ## [7.4.0](bigtable-v7.3.0...bigtable-v7.4.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>datastore: 11.2.0</summary> ## [11.2.0](datastore-v11.1.0...datastore-v11.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>error-reporting: 4.2.0</summary> ## [4.2.0](error-reporting-v4.1.0...error-reporting-v4.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>dns: 6.2.0</summary> ## [6.2.0](dns-v6.1.0...dns-v6.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>logging: 12.2.0</summary> ## [12.2.0](logging-v12.1.0...logging-v12.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>logging-bunyan: 6.2.0</summary> ## [6.2.0](logging-bunyan-v6.1.0...logging-bunyan-v6.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>logging-winston: 7.2.0</summary> ## [7.2.0](logging-winston-v7.1.0...logging-winston-v7.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> <details><summary>pubsub: 6.2.0</summary> ## [6.2.0](pubsub-v6.1.1...pubsub-v6.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) ### Bug Fixes * **pubsub:** Avoid invoking callback inside promise handler in getClient_ ([#9544](#9544)) ([752d1d7](752d1d7)) * **pubsub:** Pause underlying pull streams and skip keepalive teardown while paused ([#9521](#9521)) ([f863ecc](f863ecc)) </details> <details><summary>translate: 10.2.0</summary> ## [10.2.0](translate-v10.1.1...translate-v10.2.0) (2026-10-07) ### Features * **tools:** Add individual CLI flags for Bun monkey patches ([#9533](#9533)) ([a5eec89](a5eec89)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Shivanee Persaud <[email protected]>
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.
Summary
MessageStream): OverrodeMessageStream.pause()andMessageStream.resume()to propagatepause()andresume()to all underlyingStreamingPullgRPC streams (as well as pausing newly replaced streams whenMessageStreamis paused). Previously,MessageStreamrelied onPassThrough.prototype.pause(), which stopped pausing the underlying gRPC streams once.pipe(this)was replaced with.on('data', ...)andthis.emit('data', data).MessageStream): WhenMessageStreamis paused (for example, whenLeaseManagerpauses the stream because client-side flow control is full), underlying gRPC streams stop emittingdataevents until resumed.MessageStreamnow clears any pending 15s keepalivealiveTimers onpause()and skips arming or triggering the 15s server keepalive timeout timer while paused, while continuing to send periodic{}client keepalive writes every 30s.receivedMessagesguard (Subscriber): Added a guard inSubscriber._onData()to return early ifreceivedMessagesis undefined or empty.Verification
test/message-stream.ts,test/subscriber.ts)paste/4969690477232128)