Comments (4)
Could you elaborate more on your use case? Would this apply only the first time the master process is run?
In some of the cases the problem can be fixed without rerunning the master e.g. failing to parse a configuration file with a typo or to load a missing module. A large enough backoff value will quickly cause the respawns to be far enough between.
Looking at the code I noticed that opt.backoff
is by default undefined, which will cause all restart timers to fire quickly all the time (every second by default). Perhaps this will be solved by providing default backoff and restart values that are saner, like e.g. 60s? That way instead of a resource-intensive endless loop you would get a few fast retries, but recluster will quickly back off to occasional retries every minute, which might be an acceptable option.
from recluster.
I have a cluster master that is spinning up server forks. If these forks never get to ready
, instead of respawning, I'd like the option to kill the server. In essence, I want an option to say, "only respawn if we ever got to ready." I can see how this is not necessarily something you'd want in the default case. However, I'd argue that if a server never gets to ready, it's unlikely to get to ready ever; whereas a crashed server (one that did get to ready, ran, and hit some kind of error) is one that should be restarted.
Does that make sense? It isn't about the time period between respawns so much as having a threshold beyond which we respawn, but before which we shut down.
from recluster.
I think I understand now. If an error such as that occurs, I usually want to revert to an earlier version of the main program asap and let the automatic restart pick it up - and only in the special case where I don't want that (because for example env variables need to change) I'd provide a way to call .terminate() manually (e.g. via SIGHUP). then start the master again
However, your approach is an equally valid alternative. I'll try to find some time this weekend to give it a try. I'd also welcome a pull request, if you have the time for it :)
from recluster.
Closing with wontfix - the recommended solution is to take advantage of the backoff option to avoid wasting resources and kill the process externally if its not possible to solve the problem by swapping the code (e.g. because the problem is missing environment variables)
from recluster.
Related Issues (20)
- Multiple calls support HOT 6
- Backoff configuration may not guarantee the max time between respawns when workers die? HOT 4
- Maybe emit() function can become more clear? HOT 2
- recluster.terminate() accepts a callback as argument HOT 2
- Question: what's the correct way to gracefully shutdown a cluster and its children? HOT 3
- respawn and backoff with multiple workers HOT 2
- Daemon option HOT 2
- Respawn issue with two instances HOT 2
- Windows Support ?
- Catch Error on Cluster.reload()
- Question: How to know when all workers are ready/active? HOT 1
- Documentation for return type of activeWorkers() function is invalid
- Processes stack up on concurrent restarts HOT 5
- timeout does not work as documented HOT 5
- Add support for cwd?
- Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed on node 9.2.1 HOT 1
- recluster and nodemon on Mac OS X
- Push latest to NPM HOT 1
- Is this mondule still maintained? HOT 3
- Why execArgv is by default not process.execArgv ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from recluster.