Skip to content

Commit

Permalink
fix(pubsub): fix default stream ack deadline seconds (#3430)
Browse files Browse the repository at this point in the history
* fix(pubsub): fix default stream ack deadline seconds
  • Loading branch information
hongalex committed Dec 9, 2020
1 parent 0443e47 commit a10263a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pubsub/pullstream.go
Expand Up @@ -47,10 +47,15 @@ func newPullStream(ctx context.Context, streamingPull streamingPullFunc, subName
spc, err := streamingPull(ctx, gax.WithGRPCOptions(grpc.MaxCallRecvMsgSize(maxSendRecvBytes)))
if err == nil {
recordStat(ctx, StreamRequestCount, 1)
streamAckDeadline := int32(maxDurationPerLeaseExtension / time.Second)
// By default, maxDurationPerLeaseExtension, aka MaxExtensionPeriod, is disabled,
// so in these cases, use a healthy default of 60 seconds.
if streamAckDeadline <= 0 {
streamAckDeadline = 60
}
err = spc.Send(&pb.StreamingPullRequest{
Subscription: subName,
// We modack messages when we receive them, so this value doesn't matter too much.
StreamAckDeadlineSeconds: int32(maxDurationPerLeaseExtension / time.Second),
Subscription: subName,
StreamAckDeadlineSeconds: streamAckDeadline,
MaxOutstandingMessages: int64(maxOutstandingMessages),
MaxOutstandingBytes: int64(maxOutstandingBytes),
})
Expand Down

0 comments on commit a10263a

Please sign in to comment.