Skip to content

Commit

Permalink
Merge pull request #3501 from Unitech/refactor_api
Browse files Browse the repository at this point in the history
Refactor api
  • Loading branch information
Unitech authored Mar 2, 2018
2 parents 829cc30 + bb57c76 commit 9f2c4ca
Show file tree
Hide file tree
Showing 20 changed files with 1,326 additions and 1,548 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ $ pm2 reset [app-name] # Reset all counters
$ pm2 stop all # Stop all apps
$ pm2 stop 0 # Stop process with id 0
$ pm2 restart all # Restart all apps
$ pm2 gracefulReload all # Gracefully reload all apps in cluster mode
$ pm2 delete all # Kill and delete all apps
$ pm2 delete 0 # Delete app with id 0

Expand Down
11 changes: 1 addition & 10 deletions bin/pm2
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function checkCompletion(){
return data.short;
}), data);
// array containing commands after which process name should be listed
var cmdProcess = ['stop', 'restart', 'scale', 'reload', 'gracefulReload', 'delete', 'reset', 'pull', 'forward', 'backward', 'logs', 'describe', 'desc', 'show'];
var cmdProcess = ['stop', 'restart', 'scale', 'reload', 'delete', 'reset', 'pull', 'forward', 'backward', 'logs', 'describe', 'desc', 'show'];

if (cmdProcess.indexOf(data.prev) > -1) {
pm2.list(function(err, list){
Expand Down Expand Up @@ -390,15 +390,6 @@ commander.command('reload <name|all>')
pm2.reload(pm2_id, commander);
});

//
// Reload process(es)
//
commander.command('gracefulReload <name|all>')
.description('gracefully reload a process. Send a "shutdown" message to close all connections.')
.action(function(pm2_id) {
pm2.gracefulReload(pm2_id, commander);
});

commander.command('id <name>')
.description('get process id by name')
.action(function(name) {
Expand Down
2 changes: 1 addition & 1 deletion examples/misc-examples/graceful-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Example of graceful exit
*
* $ pm2 gracefulReload all
* $ pm2 reload all
*/

process.on('message', function(msg) {
Expand Down
27 changes: 0 additions & 27 deletions examples/sourcemap-auto-resolve/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,33 +399,6 @@ API.prototype.update = function(cb) {
return false;
};

/**
* Graceful Reload an application
*
* @param {String} process_name Application Name or All
* @param {Object} opts Options
* @param {Function} cb Callback
*/
API.prototype.gracefulReload = function(process_name, opts, cb) {
var that = this;

if (typeof(opts) == "function") {
cb = opts;
opts = {};
}

//Common.printOut(conf.PREFIX_MSG_WARNING + chalk.bold.yellow('Warning gracefulReload will be soon deprecated'));
//Common.printOut(conf.PREFIX_MSG_WARNING + chalk.bold.yellow('Use http://pm2.keymetrics.io/docs/usage/signals-clean-restart/ instead'));

if (Common.isConfigFile(process_name))
that._startJson(process_name, commander, 'softReloadProcessId');
else {
if (opts && !opts.updateEnv)
Common.printOut(IMMUTABLE_MSG);
that._operate('softReloadProcessId', process_name, opts, cb);
}
};

/**
* Reload an application
*
Expand Down
Loading

0 comments on commit 9f2c4ca

Please sign in to comment.