synth icon indicating copy to clipboard operation
synth copied to clipboard

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

Open mikaelhm opened this issue 11 years ago • 3 comments

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.

mikaelhm avatar Aug 21 '14 16:08 mikaelhm

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

JonAbrams avatar Aug 21 '14 16:08 JonAbrams

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

mikaelhm avatar Aug 21 '14 16:08 mikaelhm

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.

JonAbrams avatar Aug 21 '14 16:08 JonAbrams