Skip to content

Commit 32660c5

Browse files
manzatochris-smith
authored andcommitted
Adds support for shutting down action clients (#69)
1 parent d976c86 commit 32660c5

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/lib/ActionClient.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,24 @@ class ActionClient extends EventEmitter {
138138
});
139139
return id;
140140
}
141+
142+
/**
143+
* Shuts down this ActionClient. It shuts down publishers, subscriptions
144+
* and removes all attached event listeners.
145+
* @returns {Promise}
146+
*/
147+
148+
shutdown() {
149+
this.removeAllListeners();
150+
151+
return Promise.all([
152+
this._goalPub.shutdown(),
153+
this._cancelPub.shutdown(),
154+
this._statusSub.shutdown(),
155+
this._feedbackSub.shutdown(),
156+
this._resultSub.shutdown()
157+
]);
158+
}
141159
}
142160

143161
module.exports = ActionClient;

0 commit comments

Comments
 (0)