- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QueueTimer keeps Node process from terminating gracefully #42
Comments
Awesome find! There is no reason our queue timer can't turn itself off and then enqueue turns it back on, thoughts? We could use a timestamp to see when it should fire right away or in the future? Thoughts? Maybe we could see what wtf node does and turn off? Or we could cancel the timer if no events have been submitted in the last 2 timer hits? The shorter wait the better, if my app that I just closed stays open longer than I expect thats frustrating. If there are network problems it should just bail (you should have local storage if you want those errors. No difference for different storage implementations. |
@frankebersoll would you mind taking a stab at this. |
Maybe this is why we need the |
Possibly, would be a good idea to do that with our tests for now. I'm not sure what the best way to handle this. |
@srijken do you think this is something we should still tackle? I'm currently fine with the current behavior but I get there is an issue with cli tooling? I wonder what would happen for node lambdas. |
This has been solved in version 2.0. I haven't figured out how to detect the last statement has been executed. But if you end your app with import { Exceptionless } from "@exceptionless/node";
console.log("Cli Example");
...
await Exceptionless.suspend(); |
I want us to try unref'ing the timer we are using and wiring up to the process exit event to try and flush the queue then. |
|
This program will run and exit as expected. No events are submitted. Console output:
Whereas, if we modify the code to submit an event:
This program will run forever, unless you terminate it by sending SIGINT:
If we
npm install wtfnode
and call.dump()
, it clearly shows what's going on:From Node docs:
So, our timer is the last single callback in Node's event loop and therefore blocks it from exiting. This is probably not an issue for service-like applications, but it sucks for console tools or anything that should just exit when the work is finished.
Thoughts:
lastEventTimestamp
field?wtfnode
uses to figure out if we are the single reason that the process is still running?The text was updated successfully, but these errors were encountered: