Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pubsub): fix default stream ack deadline seconds #3430

Merged
merged 3 commits into from Dec 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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