Gathering detailed insights and metrics for signalmanager
Gathering detailed insights and metrics for signalmanager
Gathering detailed insights and metrics for signalmanager
Gathering detailed insights and metrics for signalmanager
npm install signalmanager
Typescript
Module System
Node Version
NPM Version
68.9
Supply Chain
85
Quality
74.8
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
1,153
Last Day
1
Last Week
9
Last Month
18
Last Year
79
3 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.8
Package Id
signalmanager@1.0.8
Size
2.69 kB
NPM Version
5.0.3
Node Version
8.1.2
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
125%
9
Compared to previous week
Last month
200%
18
Compared to previous month
Last year
0%
79
Compared to previous year
ES6 JS classes for socket client and server message passing
1npm install signalmanager --save
Prevent closing until your code approves it
Add shutdown handlers for SIGINT and SIGTERM.
This is in case multiple "threads" or classes need to
do individual checks before closing. (Obviously no program can withstand SIGKILL though)
Add a request handler first. It will be responsible for passing into the
callback true or false for if it approves the shutdown.
If all processes approve, all shutdown handlers are run then exited.
If any function/class passes false for REJECTION, the shutdown is canceled;
and no shutdown handlers are run.
1 2// SignalManager singleton. Should be same variable required anywhere 3var SignalManager = require('signalmanager'); 4 5// APPROVAL HANDLER 6// Generally the idea is that each service should have a shutdown approval handler to 7// ask each service before shutting down if it can safely 8SignalManager.addShutdownApprovalHandler(() => { 9 if (somethingImportantHasNotFinishedYet) { 10 return false; // do not approve shutdown. will cancel node program shutdown 11 } else { 12 return true; // will allow next handlers to run and if all approve, move on to the ShutdownHandlers 13 } 14}); 15 16// SHUTDOWN HANDLER 17// If all the approvalHandlers returned true, shutdown will begin. All shutdownHandlers 18// will be called in order of adding. Generally 19SignalManager.addShutdownHandler(() => { 20 if (isAnEmergencySomethingImportantIsStillRunning) { 21 // false here as opposed to in the approval handler probably signifies something important 22 // because by this point, other of the shutdown handlers may have run 23 return false; // do not approve shutdown. will cancel program shutdown 24 } else { 25 // these are examples of what you would do 26 someSocket.close(); 27 someFile.close(); 28 someEmail.send(); 29 30 return true; // will allow next handlers to run. Upon all returning true, it will allow exit 31 } 32}); 33 34
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
no SAST tool detected
Details
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More