From 3b5fd1f28294ca45f1ca76be14f468328c6a2557 Mon Sep 17 00:00:00 2001 From: Alex Hong Date: Mon, 21 Jun 2021 22:33:40 -0700 Subject: [PATCH] improve docs --- pubsub/flow_controller.go | 4 +++- pubsub/topic.go | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pubsub/flow_controller.go b/pubsub/flow_controller.go index 00f60e1d2415..edc844fe7845 100644 --- a/pubsub/flow_controller.go +++ b/pubsub/flow_controller.go @@ -37,9 +37,11 @@ const ( type FlowControlSettings struct { // MaxOutstandingMessages is the maximum number of bufered messages to be published. + // If less than or equal to zero, this is disabled. MaxOutstandingMessages int // MaxOutstandingBytes is the maximum size of buffered messages to be published. + // If less than or equal to zero, this is disabled. MaxOutstandingBytes int // LimitExceededBehavior configures the behavior when trying to publish @@ -54,7 +56,7 @@ var ( ErrFlowControllerMaxOutstandingBytes = errors.New("pubsub: MaxOutstandingBytes flow control limit exceeded") ) -// flowController implements flow control for Subscription.Receive. +// flowController implements flow control for publishing and subscribing. type flowController struct { maxCount int maxSize int // max total size of messages diff --git a/pubsub/topic.go b/pubsub/topic.go index 7a7d6ebb31a1..ff3e396a81be 100644 --- a/pubsub/topic.go +++ b/pubsub/topic.go @@ -99,10 +99,10 @@ type PublishSettings struct { // The maximum number of bytes that the Bundler will keep in memory before // returning ErrOverflow. This is now superseded by FlowControlSettings.MaxOutstandingBytes. - // If both are set, this value will be used for both settings. + // If MaxOutstandingBytes is set, that value will override BufferedByteLimit. // // Defaults to DefaultPublishSettings.BufferedByteLimit. - // Deprecated. + // Deprecated: Set `topic.PublishSettings.FlowControlSettings.MaxOutstandingBytes` instead. BufferedByteLimit int // FlowControlSettings defines publisher flow control settings. @@ -540,7 +540,7 @@ func (t *Topic) initBundler() { fcs := DefaultPublishSettings.FlowControlSettings // FlowControlSettings.MaxOutstandingBytes and BufferedByteLimit have generally - // the same behavior, with the latter always returning and error. BufferedByteLimit + // the same behavior, with the latter always returning an error. BufferedByteLimit // is deprecated in favor of MaxOutstandingBytes. // // While we continue to support both, check if either has been set directly, and use