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

rescue memcached errors in a consistent way #22361

Merged
merged 1 commit into from
Nov 30, 2015

Conversation

grosser
Copy link
Contributor

@grosser grosser commented Nov 21, 2015

@rafaelfranca

a small dry up PR without lots of strings attached ... I hope :D

@rails-bot
Copy link

r? @kaspth

(@rails-bot has picked a reviewer for you, use r? to override)

@grosser grosser force-pushed the grosser/rescue branch 2 times, most recently from 958b326 to 0112423 Compare November 21, 2015 02:03
@arthurnn
Copy link
Member

I think this is a good step. I would like to see, maybe in a near future, the memcached returning some kinda object, so who is calling can decide what is the success and error path. That would make easier to implement resilient memcached calls.
cc @jnunemaker because I know you ❤️ those conversations.

end
end

def rescue_error(fallback)
Copy link
Contributor

Choose a reason for hiding this comment

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

When passing in false or nil, it feels like you're turning something off. Mitigate by making this a keyword argument with _to suffix (since ´fallback: false` still sounds like turning something off):

def rescue_error(fallback_to: nil)
  # ...
end

(Note, I think we can safely default it to nil)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed it to rescue_errors_with nil to not use an extra keyword arg / allocate a hash / be simple ... looks good ?

@ArnonHongklay
Copy link

Cool!

arthurnn pushed a commit that referenced this pull request Nov 30, 2015
rescue memcached errors in a consistent way
@arthurnn arthurnn merged commit fa5426d into rails:master Nov 30, 2015
@arthurnn
Copy link
Member

thanks

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.

None yet

5 participants