mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
VersionManagment: exec_timeout is now configurable
This commit is contained in:
parent
841e6423e1
commit
4b7b4d38ce
@ -7,6 +7,10 @@
|
||||
- YAML support for apps declarations
|
||||
- Improve app declaration file parsing (log_file, out_file, error_file)
|
||||
|
||||
# 0.12.11 (Coming next)
|
||||
|
||||
- VersioningManagment: exec() timeout configurable via .json
|
||||
|
||||
# 0.12.10 (Current Stable)
|
||||
|
||||
- Fix : PM2 interactor doesn't send data about dead processes ('_old_') anymore.
|
||||
|
||||
@ -36,6 +36,8 @@ or to the optional specified commit ID.
|
||||
|
||||
Everytime a backward/pull/forward command is executed, pm2 checks in ecosystem.json, process.json and package.json (in that order) for commands to run (e.g. npm install).
|
||||
The field should be named post_update and should be an array of commands.
|
||||
You can also set the timeout for exec() command with 'exec_timeout' field (in ms).
|
||||
By default it is 60000 (60sec).
|
||||
Your file should look something like this :
|
||||
|
||||
```json
|
||||
@ -50,7 +52,8 @@ Your file should look something like this :
|
||||
"script" : "app.js",
|
||||
"post_update" : ["echo App has been updated, running npm install...",
|
||||
"npm install",
|
||||
"echo App is being restarted now"]
|
||||
"echo App is being restarted now"],
|
||||
"exec_timeout" : 30000
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -8,11 +8,12 @@ var CLI = require('../CLI.js');
|
||||
var Common = require('../Common.js');
|
||||
var cst = require('../../constants.js');
|
||||
|
||||
|
||||
var exitCli = Common.exitCli;
|
||||
var printError = Common.printError;
|
||||
var printOut = Common.printOut;
|
||||
|
||||
var EXEC_TIMEOUT = 60000; // Default: 1 min
|
||||
|
||||
var Methods = {};
|
||||
|
||||
/**
|
||||
@ -251,7 +252,8 @@ Methods.forward = function(process_name, cb) {
|
||||
var exec = function (cmd, callback) {
|
||||
var output = '';
|
||||
|
||||
var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024, timeout: 30000}, function(err) {
|
||||
var c = child.exec(cmd, {env: process.env, maxBuffer: 3*1024*1024, timeout: EXEC_TIMEOUT},
|
||||
function(err) {
|
||||
if (callback)
|
||||
callback(err ? err.code : 0, output);
|
||||
});
|
||||
@ -316,6 +318,8 @@ var getPostUpdateCmds = function(repo_path, proc_name, cb) {
|
||||
async.eachSeries(data.apps, function(item, callb) {
|
||||
if (item.name && item.name === proc_name) {
|
||||
if (item.post_update && typeof(item.post_update) === 'object') {
|
||||
if (item.exec_timeout)
|
||||
EXEC_TIMEOUT = parseInt(item.exec_timeout);
|
||||
return callb(item.post_update);
|
||||
}
|
||||
else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user