Coder Social home page Coder Social logo

How to achieve resilience about knx-go HOT 4 CLOSED

vapourismo avatar vapourismo commented on September 2, 2024
How to achieve resilience

from knx-go.

Comments (4)

vapourismo avatar vapourismo commented on September 2, 2024

A resend interval and response timeout that large are not recommendable.
Imagine a frame is lost, that means it will be resend only a minute later.

And if the heartbeat fails during that time, the connection will be terminated.

From the protocols perspective, it is almost impossible to tell if the device is just busy, dead or there is a network issue.

The library is fairly low-level. It doesn't do reconnects.

I suggest building something on top which does rebuild the tunnel client when it fails.

from knx-go.

ferllings avatar ferllings commented on September 2, 2024

Thanks,

so I should use a shorter resendInterval (500 mili), and something like 2mins for the responseTimeout as the previous unclosed connection will only be released after 1 min.

Then handle the disconnect/unavailable gateway on my app.

from knx-go.

vapourismo avatar vapourismo commented on September 2, 2024

I image it would be a channel-like abstraction on top of the TunnelClient that on repeated failure to send or on the inbound channel being closed (which indicates a closed connection) simply discards the TunnelClient and instantiates a new one. Possibly needs to make the errResponseTimeout error public so you can compare against it. That would be a simple solution.

I've had a bit of time to think about it and I think this can actually be integrated into the TunnelClient directly. However it wouldn't be too easy and I have neither the time nor the motivation nor the means to test it. In any case I am happy to accept PRs though 😄

from knx-go.

vapourismo avatar vapourismo commented on September 2, 2024

Actually, I think the TunnelClient already tries reconnect: https://github.com/vapourismo/knx-go/blob/master/knx/tunnel.go#L508

However, it only retries once. So what is needed is to extend the TunnelConfig to support a reconnect attempt counter.

from knx-go.

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.