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

error handler will fail if retry block is empty #61

Open
caljess599 opened this issue Nov 11, 2020 · 1 comment
Open

error handler will fail if retry block is empty #61

caljess599 opened this issue Nov 11, 2020 · 1 comment

Comments

@caljess599
Copy link

caljess599 commented Nov 11, 2020

I was attempting to use the config.error_handler block as documented in the README, but it turns out that if you hit a 429 with this code:

config.error_handler = {
    [429, 430, 442] => { max_retries: 5, seconds_delay: 1 },
    (500..530).to_a => { max_retries: 2, seconds_delay: 2 },
    400 => { max_retries: 3, seconds_delay: 3 },
  }

you will end up with a blank retry_block and that will cause a NoMethod (on a nil) error, and so game over--no sleep, just exit.

I solved this problem with borrowing code for the 429 error from a test in the code base that specified the retry_block:

429 => {
          max_retries: 2,
          seconds_delay: 10,
          retry_block: -> () { puts 'API returned 429 Status Code. Sleeping...' }
        },

Hard to say whether the fix here is to improve the (already noted as lacking) documentation or to not allow that retry_block to be empty, no matter what someone specifies in their config... but this cost me a bit of time so I figured I'd report it.

@jacobjlevine
Copy link

Hey @caljess599, have you actually seen evidence that the retries are working? I've been doing testing, and I'm not seeing any evidence of it. And I also haven't seen any evidence in the codebase that the gem actually retries failed API calls. It almost seems like the architects of this gem created the configuration endpoint without actually implementing it. But maybe I'm missing something?

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

No branches or pull requests

2 participants