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

Auto retry fetch errors #429

Merged
merged 3 commits into from
Sep 2, 2017
Merged

Conversation

phstc
Copy link
Collaborator

@phstc phstc commented Aug 29, 2017

Fixes #428

@phstc phstc changed the title WIP Auto retry fetch errors Aug 29, 2017
@phstc phstc force-pushed the feature/428-auto-retry-fetch-failures branch from bc57a4a to a3c9874 Compare August 29, 2017 12:36
sleep(attempts)

retry
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -9,20 +9,40 @@ def initialize(group)
end

def fetch(queue, limit)
started_at = Time.now
do_with_retry(10) do

Choose a reason for hiding this comment

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

Any thoughts on making this configurable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ethangunderson I usually make that stuff configurable on demand basis, if someone asks to configure, just to avoid adding extra options.


logger.debug { "Retrying fetch attempt #{attempts} for #{ex.message}" }

sleep(attempts)

Choose a reason for hiding this comment

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

This will act as a backoff until max attempts is reached, right? I like that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@phstc phstc merged commit 8dfe3cc into master Sep 2, 2017
@phstc phstc deleted the feature/428-auto-retry-fetch-failures branch September 2, 2017 21:10
@waynerobinson
Copy link
Contributor

Should this rescue from everything… or just fetch-related exceptions?

@phstc
Copy link
Collaborator Author

phstc commented Sep 11, 2017

@waynerobinson it used to rescue everything, then nothing, now it's rescuing everything again, but up to 3 attempts. I tried to find fetch-related exceptions before rescuing all, but it's hard to tell what are they. Is this broad rescue causing you issue?

@waynerobinson
Copy link
Contributor

Nothing in particular. But in the past I've had issues catching broad exceptions and things like catching TERM signals.

Would catching all StandardErrors be enough? It's pretty broad, but doesn't include any of the system level exceptions.

@phstc
Copy link
Collaborator Author

phstc commented Sep 12, 2017

@waynerobinson makes sense, but I believe rescue => ex rescues from StandardError and up, for Interrupt and others (system level), it would need to be rescue Exception => ex.

StandardError -- default for rescue
https://ruby-doc.org/core-2.2.0/Exception.html

@waynerobinson
Copy link
Contributor

Ahh… fair enough then! 😀

@phstc
Copy link
Collaborator Author

phstc commented Sep 12, 2017

@waynerobinson thanks a lot for review the changes 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants