Skip to content

fix(pubsub): pause underlying pull streams and skip keepalive teardown while paused - #9521

Merged
feywind merged 3 commits into
googleapis:mainfrom
feywind:pubsub/keepalive-gap2
Oct 6, 2026
Merged

feywind merged 3 commits into
googleapis:mainfrom
feywind:pubsub/keepalive-gap2

Conversation

@feywind

@feywind feywind commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Pause / resume propagation (MessageStream): Overrode MessageStream.pause() and MessageStream.resume() to propagate pause() and resume() to all underlying StreamingPull gRPC streams (as well as pausing newly replaced streams when MessageStream is paused). Previously, MessageStream relied on PassThrough.prototype.pause(), which stopped pausing the underlying gRPC streams once .pipe(this) was replaced with .on('data', ...) and this.emit('data', data).
  • Keepalive timeout handling while paused (MessageStream): When MessageStream is paused (for example, when LeaseManager pauses the stream because client-side flow control is full), underlying gRPC streams stop emitting data events until resumed. MessageStream now clears any pending 15s keepalive aliveTimers on pause() and skips arming or triggering the 15s server keepalive timeout timer while paused, while continuing to send periodic {} client keepalive writes every 30s.
  • Empty receivedMessages guard (Subscriber): Added a guard in Subscriber._onData() to return early if receivedMessages is undefined or empty.

Verification

  • Unit tests (test/message-stream.ts, test/subscriber.ts)
  • Live service verification (paste/4969690477232128)

…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().
@feywind
feywind requested a review from a team as a code owner October 5, 2026 21:14
@product-auto-label product-auto-label Bot added the api: pubsub Issues related to the Pub/Sub API. label Oct 5, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions
github-actions Bot requested a review from danieljbruce October 5, 2026 22:40
@feywind
feywind merged commit f863ecc into googleapis:main Oct 6, 2026
46 checks passed
@release-please release-please Bot mentioned this pull request Oct 6, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsub Issues related to the Pub/Sub API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants