How can we make ServerRestart (on gulp watch) more gracefull

#73 · open · 3 comments

View on GitHub ↗

mikaelhm

I have levelDB connection hooked up in a service. But, it fails when the server restarts, as the it already have a lock. So I need to release the lock when restartSever is triggered, such that I can close the db connection.

Comments

JonAbrams

So a callback on restart? On Thu, Aug 21, 2014 at 9:33 AM, Mikael Møller [email protected] wrote: > I have levelDB connection hooked up in a service. > > ## But, it fails when the server restarts, as the it already have a lock. So I need to release the lock when restartSever is triggered, such that I can close the db connection. > > Reply to this email directly or view it on GitHub: > https://github.com/JonAbrams/synth/issues/73

mikaelhm

Yes, I know that you can do it on the server. I did a small test in `lib/commands.js` adding this in `startServer` ``` server.on('close', function () { console.log('This is closing NOW!'); }) ``` So could we get server as a build-in service like req, res

JonAbrams

That would be interesting. On Thu, Aug 21, 2014 at 9:44 AM, Mikael Møller [email protected] wrote: > Yes, I know that you can do it on the server. > > I did a small test in lib/commands.js > > adding this in startServer > > server.on('close', function () { > console.log('This is closing NOW!'); > }) > > So could we get server as a build-in service like req, res > > — > Reply to this email directly or view it on GitHub > https://github.com/JonAbrams/synth/issues/73#issuecomment-52947581.