Skip to content

Commit

Permalink
improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hongalex committed Jun 22, 2021
1 parent df39d40 commit 3b5fd1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pubsub/flow_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pubsub/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3b5fd1f

Please sign in to comment.