Skip to content

Commit

Permalink
fix(pubsub): mark ignore option default for publish flow control (#5983)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongalex authored May 4, 2022
1 parent 3972c38 commit 3f41531
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pubsub/flow_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
type LimitExceededBehavior int

const (
// FlowControlBlock signals to wait until the request can be made without exceeding the limit.
FlowControlBlock LimitExceededBehavior = iota
// FlowControlIgnore disables flow control.
FlowControlIgnore
FlowControlIgnore LimitExceededBehavior = iota
// FlowControlBlock signals to wait until the request can be made without exceeding the limit.
FlowControlBlock
// FlowControlSignalError signals an error to the caller of acquire.
FlowControlSignalError
)
Expand All @@ -47,7 +47,7 @@ type FlowControlSettings struct {

// LimitExceededBehavior configures the behavior when trying to publish
// additional messages while the flow controller is full. The available options
// include Block (default), Ignore (disable), and SignalError (publish
// are Ignore (disable, default), Block, and SignalError (publish
// results will return an error).
LimitExceededBehavior LimitExceededBehavior
}
Expand Down
6 changes: 2 additions & 4 deletions pubsub/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type PublishSettings struct {
// If MaxOutstandingBytes is set, that value will override BufferedByteLimit.
//
// Defaults to DefaultPublishSettings.BufferedByteLimit.
// Deprecated: Set `topic.PublishSettings.FlowControlSettings.MaxOutstandingBytes` instead.
// Deprecated: Set `Topic.PublishSettings.FlowControlSettings.MaxOutstandingBytes` instead.
BufferedByteLimit int

// FlowControlSettings defines publisher flow control settings.
Expand Down Expand Up @@ -628,9 +628,7 @@ func (t *Topic) initBundler() {
t.scheduler.BundleByteThreshold = t.PublishSettings.ByteThreshold

fcs := DefaultPublishSettings.FlowControlSettings
if t.PublishSettings.FlowControlSettings.LimitExceededBehavior != FlowControlBlock {
fcs.LimitExceededBehavior = t.PublishSettings.FlowControlSettings.LimitExceededBehavior
}
fcs.LimitExceededBehavior = t.PublishSettings.FlowControlSettings.LimitExceededBehavior
if t.PublishSettings.FlowControlSettings.MaxOutstandingBytes > 0 {
b := t.PublishSettings.FlowControlSettings.MaxOutstandingBytes
fcs.MaxOutstandingBytes = b
Expand Down

0 comments on commit 3f41531

Please sign in to comment.