Giter Club home page Giter Club logo

Comments (4)

eli-darkly avatar eli-darkly commented on June 9, 2024 1

I think I see. If it's "after every event" then that means each connection was initially successful. It does reset the counter in that case - this was intended behavior, because we didn't want intermittent failures to cause increasingly long delays if they only happened once in a while.

I agree that this is still not quite right; if we want to avoid continuing to increase the backoff when things have been working correctly, we should probably have a time threshold, like only reset the counter if the connection has stayed good for X amount of time. Also, I think there is currently a flaw in the logic such that the backoff will not always be incremented even on failed connections. I'll look into this further.

Also, thanks for catching that null issue. I think that in actual use cases that string will not be null (it ultimately comes from StreamReader.ReadLine which can return a null on end of stream, but I think if the connection is closed we will get an I/O error first) but that's not the kind of thing we should rely on.

from dotnet-eventsource.

eli-darkly avatar eli-darkly commented on June 9, 2024

Hmm. Are you definitely using the latest release? The problem where MaybeWaitWithBackOff was being called without an await was fixed last month in version 3.1.2. You can see the current version of that line here.

from dotnet-eventsource.

magicxor avatar magicxor commented on June 9, 2024

For some reason I was using the code from 4da02fb commit, but the problem persists in 3.1.5 too. If the server disconnects after every event, _backOff.GetReconnectAttemptCount() will be always 0 (so actually there will be no delay), which may result in high CPU and network consumption.

I also noticed that if content == null NullReferenceException will be thrown. I'm not sure if it's a normal flow or not, but it looks a bit suspicious.

from dotnet-eventsource.

eli-darkly avatar eli-darkly commented on June 9, 2024

I believe both the "not increasing the delay after an immediately failed connection" issue and the NullReferenceException have been fixed in the 3.2.0 release.

from dotnet-eventsource.

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.