ericabouaf / aws-swf

Node.js helpers to access the Amazon SWF API
MIT License
74 stars 40 forks source link

Easier integration with supervisor #48

Closed ktonon closed 8 years ago

ktonon commented 8 years ago

In this commit:

The motivation is easier integration with supervisor. If I start my decider like this

supervisor -- decider.js

using supervisor, and only register a handler for SIGINT, the process will get terminated immediately instead of waiting for the last long poll to complete.

Registering a handler for both SIGINT and SIGTERM fixes the issue, and seems like a good idea anyhow.

This PR just makes it a bit easier to register the handler twice and ensure that stop() is only called once. Although it doesn't matter at the moment if stop is called more than once, implementation details may change in the future. It also logs Stopping the poller after this request... only once.