Skip to content

Commit

Permalink
pubsub: clarify extension documentation
Browse files Browse the repository at this point in the history
Change-Id: I9e886a95bba1338145e6b1dd80616a0442ffec4c
Reviewed-on: https://code-review.googlesource.com/c/35094
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Michael Darakananda <pongad@google.com>
  • Loading branch information
jeanbza committed Nov 6, 2018
1 parent 2de6e15 commit 9ac12b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions pubsub/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ minutes, every 3 minutes. Suppose the application crashes 5 seconds after the
library sends such an extension: the Pub/Sub server would wait the remaining
2m55s before re-sending the messages out to other subscribers.
Please note that the client library does not use the subscription's AckDeadline
by default. To enforce the subscription AckDeadline, set MaxExtension to
to the subscription's AckDeadline:
cfg, err := sub.Config(ctx)
if err != nil {
// TODO handle err
}
sub.ReceiveSettings.MaxExtension = cfg.AckDeadline
Slow Message Processing
For use cases where message processing exceeds 30 minutes, we recommend using
Expand Down
6 changes: 4 additions & 2 deletions pubsub/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ type ReceiveSettings struct {
//
// The Subscription will automatically extend the ack deadline of all
// fetched Messages up to the duration specified. Automatic deadline
// extension may be disabled by specifying a duration less than 0.
// extension beyond the initial receipt may be disabled by specifying a
// duration less than 0.
MaxExtension time.Duration

// MaxOutstandingMessages is the maximum number of unprocessed messages
Expand Down Expand Up @@ -436,7 +437,8 @@ var errReceiveInProgress = errors.New("pubsub: Receive already in progress for t
// The context passed to f will be canceled when ctx is Done or there is a
// fatal service error.
//
// Receive will automatically extend the ack deadline of all fetched Messages up to the
// Receive will send an ack deadline extension on message receipt, then
// automatically extend the ack deadline of all fetched Messages up to the
// period specified by s.ReceiveSettings.MaxExtension.
//
// Each Subscription may have only one invocation of Receive active at a time.
Expand Down

0 comments on commit 9ac12b9

Please sign in to comment.