Giter Club home page Giter Club logo

socketlabs-ruby's People

Contributors

bernardharrison avatar billvolz avatar david-schrenker avatar praneethchandrathota avatar ryan-lydz avatar workman avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

socketlabs-ruby's Issues

Retry handler loop continues to send after successful delivery

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.

[NoMethodError] empty not defined for server ID integer

I'm trying to send a basic email from a local app and keep running into an error with the validation of the server ID number. The documentation is clear that it should be an integer, but the validation function is failing on the empty check. Here is the stack trace, with my server ID changed to a nonsense integer.

Traceback (most recent call last):
        5: from email_test.rb:21:in `<main>'
        4: from email_test.rb:18:in `send_basic_email'
        3: from /home/matthew/.rvm/gems/ruby-2.7.5/gems/socketlabs-injectionapi-1.2.1/lib/socketlabs/injectionapi/socketlabsclient.rb:44:in `send'
        2: from /home/matthew/.rvm/gems/ruby-2.7.5/gems/socketlabs-injectionapi-1.2.1/lib/socketlabs/injectionapi/socketlabsclient.rb:83:in `send_basic_message'
        1: from /home/matthew/.rvm/gems/ruby-2.7.5/gems/socketlabs-injectionapi-1.2.1/lib/socketlabs/injectionapi/socketlabsclient.rb:141:in `validate_message'
/home/matthew/.rvm/gems/ruby-2.7.5/gems/socketlabs-injectionapi-1.2.1/lib/socketlabs/injectionapi/core/send_validator.rb:47:in `validate_credentials': undefined method `empty?' for 123:Integer (NoMethodError)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.