Giter VIP home page Giter VIP logo

Comments (5)

wallyqs avatar wallyqs commented on June 18, 2024

Hi @krumts , thanks for super detailed investigation and summary of issue, this helped a lot.
Seems the combination of infinite reconnects (:max_reconnect_attempts: -1) and uncaught exceptions is making the client get stuck trying to reconnect without backing off each time, and agree that should be handled more gracefully.

Have a branch in the works where the client would not get stuck as in this case, so that the exception is raised instead, let me know if you have any feedback too. Thanks!
https://github.com/nats-io/ruby-nats/compare/time-based-reconnect-backoff

from nats.rb.

krumts avatar krumts commented on June 18, 2024

Hi @wallyqs , thanks for the quick reply! Nice to see that the investigation was helpful.
I tried running my test locally with the changes in client.rb, and the endless loop did not appear again.
However, I just had a look at the changes, and believe there is one error in the condition here:
https://github.com/nats-io/ruby-nats/compare/time-based-reconnect-backoff#diff-ef391b2fe211800bc221ab248b46db86R819
As it is now, both the if and else blocks return true.
If I understand the code properly, in case the if condition is fulfilled (time since last reconnect is greater than the configured one?), then false should be returned, meaning no delay is needed. Is this so?

Thanks again!

from nats.rb.

wallyqs avatar wallyqs commented on June 18, 2024

good catch, that's definitely a bug... 😓
thanks for taking a look!

from nats.rb.

wallyqs avatar wallyqs commented on June 18, 2024

@krumts Fix is in master and will prepare a release including the change soon, thanks again.

from nats.rb.

wallyqs avatar wallyqs commented on June 18, 2024

@krumts pushed earlier a version of the gem which has this fix now: https://rubygems.org/gems/nats/versions/0.8.2

from nats.rb.

Related Issues (20)

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.