-
Notifications
You must be signed in to change notification settings - Fork 460
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
Add reconnect loop for GCP pub/sub subscriptions #1293
Add reconnect loop for GCP pub/sub subscriptions #1293
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM; per the PR template, can you make sure that there's an issue filed in https://github.com/dapr/docs for the new config metadata properties? It helps to make sure that the added features are appropriately documented with each release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM!
Spoke too soon: Linter is complaining the code needs a |
yes, it must be the automated commit for the log message typo, I will fix it tomorrow morning when I am back at work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pkedy Can this use the retry logic from the kit library?
Yes. I think dapr/kit/retry probably makes sense here. No loop needed. I’ll paste some links to examples in other components. Usage is pretty simple and straightforward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions for using the dapr/kit/retry
package.
I don't think the behavior implemented with the retry loop in this PR can be achieved by simply using Even if the back-off library is used within a loop, the behavior still won't be the same - retry attempts are used and slowly refilled back up over time - the longer the subscription connection lasts, the more retry attempts accumulate up to max retries. Only if retry attempts are used up in quick succession will the retry loop stop retrying. |
@yordan-pavlov thanks for the explanation. I’ll take a closer look at this after a few days of Thanksgiving PTO. |
@yordan-pavlov sorry for the delay. I'm preparing for a conference talk with week. |
Signed-off-by: Yordan Pavlov <yordan.pavlov@dunnhumby.com>
b56a498
to
022c67a
Compare
@yaron2 I have fixed the DCO issues and now all checks are passing; it would be great if this PR could be included in the 1.6 release. |
@pkedy can you give this another look to decide whether |
@yordan-pavlov can you please resolve conflicts? |
Signed-off-by: Yordan Pavlov <yordan.pavlov@dunnhumby.com>
@Taction done - conflict resolved |
Codecov Report
@@ Coverage Diff @@
## master #1293 +/- ##
==========================================
- Coverage 35.79% 35.77% -0.03%
==========================================
Files 160 160
Lines 14637 14680 +43
==========================================
+ Hits 5240 5252 +12
- Misses 8829 8860 +31
Partials 568 568
Continue to review full report at Codecov.
|
dapr/kit retry doesn't seem to be a good fit here, besides pkedy does not have time to further review
@yordan-pavlov I have merged this. Please make sure to complete the docs PR against the v1.7 branch of docs as soon as possible. dapr/docs#1970 |
thanks @berndverst, docs pull request added here dapr/docs#2262 |
Description
Add a reconnection loop for GCP pub/sub subscriptions, very similar to the one that already exists for Azure Service Bus subscriptions here https://github.com/dapr/components-contrib/blob/master/pubsub/azure/servicebus/servicebus.go#L384
This is related to #1250 where the connection to a GCP pub/sub subscription could be lost due to a recoverable error. Even if the GCP pub/sub library does handle some recoverable errors internally, a reconnect loop can still be useful in a number of cases. For example:
Issue reference
Please reference the issue this PR will close: #1250
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: