Closed igor47 closed 10 years ago
@martinrhoads this might solve the current problem you're interested in re: restarts eating CPU in production. this resulted from how we refactored the cookbooks to install nerve even if no services are defined.
seems reasonable assuming it's been tested adequately
<3 this!
tested in vagrant and on some production boxes, so merging
in order to support the use case of dynamic registration, nerve should continue running even if it was started with no services defined in it's config. this re-structures the main thread to make that possible.
the main action of the main thread is to sleep, waiting for an interrupt. an interrupt triggers the reaping of existing watchers, of which there may be none.
as a byproduct, we create an interface to add additional watchers dynamically. a hypothetical future TCP server can call
launch_watcher
on the main class to register a new watcher. similarly, it can callreap_watcher
to kill a watcher.@brndnmtthws maybe this could be the basis of your new API? this is not yet tested. working on additional tests around exiting/signal handling in smartstack-cookbook