feat(pubsub): add message and acknowledgment batching - #338
Conversation
|
/gcbrun |
There was a problem hiding this comment.
Code Review
This pull request introduces message batching and retry settings (PublishSettings) for Topic publishing, along with lifecycle improvements such as an asynchronous close() method and safer batch completion handling. Review feedback suggests optimizing the message size calculation by avoiding utf8.encode() allocations to reduce memory churn, and simplifying a redundant Future.value return in an async method.
| String topic, | ||
| List<Message> messages, | ||
| ) async { | ||
| if (messages.isEmpty) return Future.value(<String>[]); |
There was a problem hiding this comment.
In an 'async' function, returning 'Future.value(...)' is redundant because any returned value is automatically wrapped in a 'Future'. You can simplify this by returning the list literal directly.
| if (messages.isEmpty) return Future.value(<String>[]); | |
| if (messages.isEmpty) return <String>[]; |
There was a problem hiding this comment.
Fixed: Removed the redundant Future.value(...) wrapping in publishMessages (and similarly in acknowledge and modifyAckDeadline).
e907d4a to
9e88ae0
Compare
5f98a79 to
791b1c7
Compare
|
/gcbrun |
9e88ae0 to
3159630
Compare
|
/gcbrun |
Add exponential backoff retry settings (RetrySettings) with jitter, totalTimeout support, and transient error classification (isRetryable) to package:google_cloud_pubsub. TAG=agy CONV=bc7c6164-e9cb-4a0f-b326-7752c814e1ce
3159630 to
b6398bc
Compare
791b1c7 to
5ad97bc
Compare
|
/gcbrun |
Add request batching infrastructure (Batcher, BatchingSettings), background message batching and lifecycle management for Topic publishing (PublishSettings), background acknowledgment and deadline modification batching for Subscriptions (AckSettings), and batch publishing via PubSub.publishMessages. TAG=agy CONV=bc7c6164-e9cb-4a0f-b326-7752c814e1ce
b6398bc to
1379642
Compare
5ad97bc to
64e494c
Compare
|
Collapsed into PR #292 (retries + batching combined). |
This is Part 2 of 3 in a stacked set of PRs:
RetrySettings,Batcher,BatchingSettings)PublishSettings,Topic.publish,Topic.close)AckSettings,Subscription.streamingPull,Subscription.close)Key Features in Part 2
PublishSettingscontrolling background batching (BatchingSettings) and unary retry configuration (RetrySettings) forTopic.publish.Topic.close()that flushes pending batches and awaits in-flight RPCs, preventing subsequent publishes withStateError.Topic.create()returnsthisrather than constructing a new default instance, preserving configuredpublishSettings.Message.toString()andReceivedMessage.toString().TAG=agy
CONV=bc7c6164-e9cb-4a0f-b326-7752c814e1ce
Stack created with GitHub Stacks CLI • Give Feedback 💬