Skip to content
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

Anyway doing the tracking more fast? #34

Open
tinganho opened this issue Feb 5, 2015 · 6 comments
Open

Anyway doing the tracking more fast? #34

tinganho opened this issue Feb 5, 2015 · 6 comments

Comments

@tinganho
Copy link

tinganho commented Feb 5, 2015

I think insight is blocking a process from exiting. I wonder if you can do like yeoman/update-notifier? and make a child process that is not blocking the main process from exiting?

@sindresorhus
Copy link
Member

It should already work exactly the same. If it's not it's a bug. Can you elaborate more on what you're experiencing?

@tinganho
Copy link
Author

tinganho commented Feb 5, 2015

I'm just experiencing a random delay instead of a near instant exit when I execute a CLI method.

@sindresorhus
Copy link
Member

Node version and OS? Submitting a failing test would accelerate how fast this is fixed ;)

@tinganho
Copy link
Author

node v0.10.33 on Mac OSX.

@matheuss
Copy link

matheuss commented May 22, 2016

I'm also experiencing this.

'use strict'
const Insight = require('insight');

const insight = new Insight(...);

if (process.argv[2] === 'track')  {
    insight.track('test');
}

image

Also, I did some tests and I'm almost sure that if i call process.exit() right after insight.track(), the track does not occur. I'll look into it and report here when I get something more concrete.

@dpogue
Copy link

dpogue commented Apr 17, 2019

It appears that child_process.fork() is causing the parent process to wait. Switching to child_process.spawn() and passing the payload as a JSON string argument (which is what update-notifier does) fixes the waiting, but I haven't checked whether the child process actually runs properly in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants