Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Add client side backoff retries for pubsub messages #1218

Merged
merged 10 commits into from
Jun 9, 2020

Conversation

yolocs
Copy link
Member

@yolocs yolocs commented Jun 4, 2020

Fixes #1100

Additional Changes

  • added handler constructor to initialize new fields
  • removed pool package as it feels a bit unnature to have a deeper package pkg/broker/handler/pool depend on a parent package pkg/broker/handler implementation; no functional change involved

Release Note

Add client side backoff retries for pubsub messages

Docs

@googlebot googlebot added the cla: yes (override cla status due to multiple authors bug) label Jun 4, 2020
@yolocs yolocs removed request for Harwayne and ian-mi June 4, 2020 18:50
@yolocs
Copy link
Member Author

yolocs commented Jun 4, 2020

/retest

1 similar comment
@yolocs
Copy link
Member Author

yolocs commented Jun 4, 2020

/retest

pkg/broker/handler/handler.go Outdated Show resolved Hide resolved
pkg/broker/handler/handler_test.go Outdated Show resolved Hide resolved
pkg/broker/handler/handler_test.go Outdated Show resolved Hide resolved
pkg/broker/handler/handler_test.go Outdated Show resolved Hide resolved
cmd/broker/retry/main.go Outdated Show resolved Hide resolved
cmd/broker/fanout/main.go Outdated Show resolved Hide resolved
cmd/broker/retry/main.go Show resolved Hide resolved
pkg/broker/handler/handler_test.go Outdated Show resolved Hide resolved
pkg/broker/handler/handler_test.go Show resolved Hide resolved
Copy link
Contributor

@ian-mi ian-mi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a retry policy is not yet set anywhere?

pkg/broker/handler/handler.go Outdated Show resolved Hide resolved
@@ -58,6 +58,9 @@ type envConfig struct {

// Max to 10m.
TimeoutPerEvent time.Duration `envconfig:"TIMEOUT_PER_EVENT"`

MinRetryBackoff time.Duration `envconfig:"MIN_RETRY_BACKOFF" default:"1s"`
MaxRetryBackoff time.Duration `envconfig:"MAX_RETRY_BACKOFF" default:"30s"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if this should be a bit longer, like a few minutes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long would you suggest? I don't have a preference. I simply don't want to over blocking the queue because of the limitation we have today.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to 1m now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just think if the backoff reaches 30s, it's very likely the issue is not transient, and some longer backoff is probably better.

But just a guess. We can always tune this later. 1min seems good to me.

@liu-cong
Copy link
Contributor

liu-cong commented Jun 8, 2020

/lgtm
/approve

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liu-cong, yolocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yolocs
Copy link
Member Author

yolocs commented Jun 8, 2020

/retest

1 similar comment
@yolocs
Copy link
Member Author

yolocs commented Jun 8, 2020

/retest

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-google-knative-gcp-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/broker/handler/fanout.go Do not exist 88.4%
pkg/broker/handler/handler.go 82.9% 84.6% 1.8
pkg/broker/handler/options.go Do not exist 88.9%
pkg/broker/handler/pool.go Do not exist 82.1%
pkg/broker/handler/providers.go Do not exist 60.0%
pkg/broker/handler/retry.go Do not exist 86.4%
pkg/broker/handler/wire_gen.go Do not exist 75.0%

@liu-cong
Copy link
Contributor

liu-cong commented Jun 8, 2020

/lgtm

@nachocano
Copy link
Member

nachocano commented Jun 9, 2020 via email

@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-google-knative-gcp-integration-tests 0/3
pull-google-knative-gcp-wi-tests pull-google-knative-gcp-wi-tests
pull-google-knative-gcp-wi-tests
2/3

Automatically retrying due to test flakiness...
/test pull-google-knative-gcp-wi-tests

@knative-prow-robot knative-prow-robot merged commit 5556846 into google:master Jun 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved cla: yes (override cla status due to multiple authors bug) lgtm size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broker retry retries sending failed events immediately
8 participants