-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hey Socketlabs team!
Summary
I signed up for a dev account and started working with this gem last night. I started with the example code displayed on onboarding and tweaked it a bit to test send an email. After calling client.send(message), the process appears to hang.
Impact
Retry Handler will continue to send successful requests endlessly, causing emails to send until the server rejects the request or the process is terminated.
Details
The retry handler appears to continue to send the same message repeatedly even if the message has already been sent or if an 500, 502-504 range HTTP status code is returned. The only time this stops is if the client encounters a non-timeout exception or a timeout exception after retries attempts conditions have been met.
After a bit of digging, it appears a successful response is never returned in RetryHandler, causing an endless loop of successful requests.
This occurs both when maximum_number_of_retries is set to 0 or greater than 0.
To Reproduce
This can be reproduced by using the current client, Ruby 2.7.0(but any ruby should have similar results), and the Ruby onboarding code. My gist will also reproduce it.
Suggested Changes
I have a fork with the following updates that fix several issues related to the retry response and returning the response. I added this for my needs, but believe it'll be helpful to other users of the gem.
- Returns a successful response
- Returns ServerException for 5XX HTTP errors after max retries have been met.
- Added sleep to 5XX HTTP errors to retry with existing backoff logic used for Timeouts.
- Returns the result from
InjectionResponseParser::parseinstead ofInjectionResponseParserinstance.