launchfort / bullseye

A simple process monitor for fast dev-reload cycles
MIT License
0 stars 0 forks source link

restart doesn't work properly -- doesn't restart and never resolves promise #1

Open matb33 opened 7 years ago

matb33 commented 7 years ago

After extensive debugging, it appears as though this line is the cause: https://github.com/gradealabs/bullseye/blob/master/src/index.ts#L135

I'm unsure why it's .send('shutdown'). It should be .kill('SIGINT'), which I've confirmed fixes the issue.

dschnare commented 7 years ago

Read the readme, your app/server needs to respond to the 'shutdown' message. https://github.com/gradealabs/bullseye#graceful-shutdown

dschnare commented 7 years ago

Also, look at the "Ready message" section in the API section. You should signal ready if the --waitForReady flag is set when calling bullseye. https://github.com/gradealabs/bullseye#api

dschnare commented 7 years ago

The generator we maintain has code that handles the ready message and the shutdown message for use already. If you are still encountering issues then it might be unrelated to bullseye, but the file watchers and/or the call to restart() on the bullseye process handle. Anyway, let me know if it still occurs after adding a handler for the shutdown message.

matb33 commented 7 years ago

Just to be clear, I've been using the generator.

The problem then is in the generated code. You are wrapping it in a if (process.env.NODE_ENV === 'development') { so it won't work unless you set NODE_ENV to development somewhere.

Currently it doesn't look like the generator sets a dev entry under scripts in package.json: https://github.com/gradealabs/generator-feathers/blob/esm/generators/app/configs/package.json.js#L42

The one I have that I pulled from our client project looks like this:

"dev": "node --require ts-node/register ./scripts/dev",

That won't be enough -- we'll need to change it to the following for it to work with the generated code:

"dev": "NODE_ENV=development node --require ts-node/register ./scripts/dev",

I've confirmed that this works.