Skip to content

docs(pubsub): improve flush documentation#4930

Merged
suzmue merged 2 commits intogoogleapis:mainfrom
suzmue:flush
Mar 9, 2026
Merged

docs(pubsub): improve flush documentation#4930
suzmue merged 2 commits intogoogleapis:mainfrom
suzmue:flush

Conversation

@suzmue
Copy link
Copy Markdown
Collaborator

@suzmue suzmue commented Mar 6, 2026

This rework of the documentation attempts to make the wording and the example more concise. It also now tries to guide users to await on the PublishFutures instead.

@suzmue suzmue requested a review from a team as a code owner March 6, 2026 23:32
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Mar 6, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.94%. Comparing base (75bbe0c) to head (d9527df).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4930   +/-   ##
=======================================
  Coverage   93.94%   93.94%           
=======================================
  Files         221      221           
  Lines        8538     8538           
=======================================
  Hits         8021     8021           
  Misses        517      517           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +106 to +107
/// messages buffered at the time of the call have reached a terminal state
/// (success or permanent failure).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Optional:

Suggested change
/// messages buffered at the time of the call have reached a terminal state
/// (success or permanent failure).
/// messages buffered at the time of the call have been successfully delivered,
/// the retry policy determines the error is permanent, or the retry policy has
/// been exhausted.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I skipped this suggestion for now.

Comment on lines +111 to +115
/// * **Individual Confirmation:** For most use cases, it is better to `.await`
/// the [`PublishFuture`][crate::publisher::PublishFuture] returned by
/// [`publish`][Self::publish] to retrieve message IDs and handle specific errors.
/// * **Collective Flush:** Use `flush()` for collective confirmation or as a
/// convenience during application shutdown to ensure all outstanding data is sent.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not sure what "collective flush" or "collective confirmation" are 1.

Suggested change
/// * **Individual Confirmation:** For most use cases, it is better to `.await`
/// the [`PublishFuture`][crate::publisher::PublishFuture] returned by
/// [`publish`][Self::publish] to retrieve message IDs and handle specific errors.
/// * **Collective Flush:** Use `flush()` for collective confirmation or as a
/// convenience during application shutdown to ensure all outstanding data is sent.
/// * For most use cases, we recommend you `.await`
/// the [`PublishFuture`][crate::publisher::PublishFuture] returned by
/// [`publish`][Self::publish] to retrieve message IDs and handle specific errors.
/// * Use `flush()` as a convenience during application shutdown to ensure all
/// outstanding data is sent.

Footnotes

  1. Sounds like something the communist cadres would ask you to commit to, but maybe I have been reading too much 20th-century history.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: maybe "to ensure the client attempts to send all outstanding data." ?

flush() can't tell you if the data was actually sent or not.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done.

@suzmue suzmue enabled auto-merge (squash) March 9, 2026 17:05
@suzmue suzmue merged commit c324256 into googleapis:main Mar 9, 2026
35 checks passed
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.

3 participants