docs(pubsub): improve flush documentation#4930
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
| /// messages buffered at the time of the call have reached a terminal state | ||
| /// (success or permanent failure). |
There was a problem hiding this comment.
Optional:
| /// 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. |
There was a problem hiding this comment.
I skipped this suggestion for now.
src/pubsub/src/publisher/client.rs
Outdated
| /// * **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. |
There was a problem hiding this comment.
I am not sure what "collective flush" or "collective confirmation" are 1.
| /// * **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
-
Sounds like something the communist cadres would ask you to commit to, but maybe I have been reading too much 20th-century history. ↩
There was a problem hiding this comment.
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.
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.