Coder Social home page Coder Social logo

Comments (5)

mcollina avatar mcollina commented on July 22, 2024 1

This should be fixed in pino-socket, moving it there.

from pino-socket.

mcollina avatar mcollina commented on July 22, 2024 1

Yes it should be ok to emit open multiple times

from pino-socket.

mcollina avatar mcollina commented on July 22, 2024

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

from pino-socket.

ggrossetie avatar ggrossetie commented on July 22, 2024

This should be fixed in pino-socket, moving it there.

I cannot reproduce this issue when using TcpConnection directly.

Remember to add unit tests.

I can add a unit test to demonstrate that TcpConnection can reconnect even if the TCP server wasn't available at the start.

from pino-socket.

ggrossetie avatar ggrossetie commented on July 22, 2024

I think I found two issues!

The first one is that we shouldn't emit an error on the writable stream when reconnect is true (because it's a recoverable error). Otherwise, thread-stream will destroy the stream/worker.

The second one is that we do not emit outputStream.emit('open', socket.address()) when we reconnect. If the initial connect fails then we won't emit open and as a result we won't receive any data.

Here's the initial connect:

connect(() => {
outputStream.emit('open', socket.address())
})

And here's the reconnect where we do not emit open:

connect((err) => {
if (connected === false) {
return retry.backoff(err)
}
if (options.recovery) {
recoverEnqueuedData()
}
})

Is it OK to emit an open event every time we connect or reconnect?

from pino-socket.

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.