Skip to content
Permalink
Browse files
fix(pubsub): fix default stream ack deadline seconds (#3430)
* fix(pubsub): fix default stream ack deadline seconds
  • Loading branch information
hongalex committed Dec 9, 2020
1 parent 0443e47 commit a10263adc2ec9483ecedd0bf0b028863342ea760
Showing with 8 additions and 3 deletions.
  1. +8 −3 pubsub/pullstream.go
@@ -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),
})

0 comments on commit a10263a

Please sign in to comment.