smartfile / node-cluster-harakiri Goto Github PK
View Code? Open in Web Editor NEWStartup workers and kill them at regular intervals
License: MIT License
Startup workers and kill them at regular intervals
License: MIT License
Move your setup from global scope into a configure()
function. Then call this from global scope and use env. variables by default. This allows a user of the library to configure node-cluster-harakiri
from code by calling the function if they wish.
The cluster
module follows this pattern.
https://nodejs.org/api/cluster.html#clustersetupmastersettings
Move this check to the setInterval()
above and use a default interval if WORKER_TTL
is not defined.
https://github.com/smartfile/node-cluster-harakiri/blob/master/lib/index.js#L38
Then you will check repeatedly if a process is ready to die. This will help you to implement this:
#1
Use once
here and eliminate the next line? Same lower down.
https://github.com/smartfile/node-cluster-harakiri/blob/master/lib/__test__/index.test.js#L42
https://github.com/smartfile/node-cluster-harakiri/blob/master/lib/__test__/index.test.js#L63
Keep track of the time that a process was killed. Allow the user to configure a grace period. Ensure nothing else is killed within that grace period. This will ensure that all the workers are not recycled at once.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.