Comments (5)
This is unfortunate, sorry (not getting a response back from FIN
) 😁
I have a suggestion though: what about tracking outstanding messages and waiting for that to hit 0 before allowing the process to exit?
I don't think it's as important to "delay" the actual FIN event vs. ensuring that you'v written/flushed the data to the socket before exiting (best effort).
from nsq.js.
Hmmm I wonder how we can sneak the .write callback in without being super derpy. We have the .command() callback already, so we might have to pass another one I guess haha, or only pass it on the !hasResponseCallback() check maybe
from nsq.js.
Yeah something like that @visionmedia, I'll take a look when we need to refactor other things.
@mreiferson we actually already do that. The problem is that were cheating and not providing callbacks to writes() since you can rely on error events to detect most issues. However when we write and then immediately decrement the counters, in the case of closing the process, it will think everything is safe to close because the counter is zero, but the write() may not have finished quite yet. YAY async!
Really only a problem on a super busy reader, but we have a couple of those :-)
from nsq.js.
Ah, I see, cool.
What about just force-flushing the socket (and waiting for that callback to return) before you finally exit (after the outstanding message counter has hit 0)... is that possible?
from nsq.js.
Think so, probably plays into the socket close event somewhere. Good call!
from nsq.js.
Related Issues (20)
- better starvation handling
- Priority / QOS HOT 4
- add callback to .close() HOT 1
- postpone reconnection attempt until lookup is performed
- tests are wonky HOT 1
- don't reconnect if identify fails HOT 2
- lookup backoff / jitter
- writes and closes
- support Ready(count) HOT 4
- uncatchable error HOT 3
- tls support HOT 1
- Memory leak caused by setInterval
- npm install nsq.js error HOT 2
- errors for touching msgs in flight
- Pause/Resume is broken
- Deferred publish
- Reconnection to dead nsqd nodes HOT 2
- Run nsq.js on React.js HOT 2
- Writer does not work with using nsqlookupd HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nsq.js.