kafka icon indicating copy to clipboard operation
kafka copied to clipboard

Clear out timeout timer when connection is made

Open rmdave opened this issue 8 years ago • 1 comments

I init() a connection, send() messages and then end() the connection in less than 500ms. The timer was on the event loop so node would exit after 3+ seconds. My logic now exits in less than 500ms with this change.

rmdave avatar Jun 23 '16 16:06 rmdave

I added some code a while back to deal with this scenario during unit tests where I was spinning up a thing that held a no-kafka client and shutting it down before doing anything, and in my haste I may have made this particular problem worse. This looks like a useful fix though, because that timer often hangs around and troubleshooting no-kafka connection internals with wtfnode can sometimes be confused by having those timer callbacks alive.

If you're fast enough too, you'll notice that any mocha tests would wait at least 5 seconds until the timeout had run - even if they completed instantly.

steve-gray avatar Sep 12 '16 10:09 steve-gray