Skip to content

Retry handler loop continues to send after successful delivery #9

@Workman

Description

@Workman

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::parse instead of InjectionResponseParser instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions