From 74f31853ac733643dfc2d2d56d64bcaa2a427b8e Mon Sep 17 00:00:00 2001 From: Pedro Teixeira Date: Fri, 30 Jun 2017 10:52:20 +0100 Subject: [PATCH 1/2] fix: succeed when stopping already stopped --- src/core/components/stop.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/components/stop.js b/src/core/components/stop.js index 33e0a4a3c1..52bf9a27e1 100644 --- a/src/core/components/stop.js +++ b/src/core/components/stop.js @@ -7,6 +7,11 @@ module.exports = (self) => { callback = callback || function noop () {} self.log('stop') + if (self.state.state() === 'stopped') { + callback() + return + } + const done = (err) => { if (err) { self.emit('error', err) From eb49e32256ac6f7743aebd95e498710e8517e71c Mon Sep 17 00:00:00 2001 From: David Dias Date: Fri, 30 Jun 2017 15:29:51 +0100 Subject: [PATCH 2/2] Update stop.js --- src/core/components/stop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/components/stop.js b/src/core/components/stop.js index 52bf9a27e1..d5fb672c84 100644 --- a/src/core/components/stop.js +++ b/src/core/components/stop.js @@ -1,6 +1,7 @@ 'use strict' const series = require('async/series') +const setImmediate = require('async/setImmediate') module.exports = (self) => { return (callback) => { @@ -8,8 +9,7 @@ module.exports = (self) => { self.log('stop') if (self.state.state() === 'stopped') { - callback() - return + return callback() } const done = (err) => {