mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Clear node.close timeout to avoid unnecessary work on restart
This commit is contained in:
parent
e7f942eda7
commit
a6ecb54cc4
@ -571,15 +571,18 @@ function stopNode(node,removed) {
|
||||
Log.trace("Stopping node "+node.type+":"+node.id+(removed?" removed":""));
|
||||
const start = Date.now();
|
||||
const closePromise = node.close(removed);
|
||||
let closeTimer = null;
|
||||
const closeTimeout = new Promise((resolve,reject) => {
|
||||
setTimeout(() => {
|
||||
closePromise = setTimeout(() => {
|
||||
reject("Close timed out");
|
||||
}, nodeCloseTimeout);
|
||||
});
|
||||
return Promise.race([closePromise,closeTimeout]).then(() => {
|
||||
clearTimeout(closeTimer);
|
||||
var delta = Date.now() - start;
|
||||
Log.trace("Stopped node "+node.type+":"+node.id+" ("+delta+"ms)" );
|
||||
}).catch(err => {
|
||||
clearTimeout(closeTimer);
|
||||
node.error(Log._("nodes.flows.stopping-error",{message:err}));
|
||||
Log.debug(err.stack);
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user