Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
feat(shutdown): Add shutdown Function to Universe
Browse files Browse the repository at this point in the history
Provides a new shutdown function on the Universe class. It allows
to stop all underlying services properly.
  • Loading branch information
swissmanu committed Nov 22, 2016
1 parent f24a6ef commit 4171c32
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,15 @@ Universe.prototype.getClientForHub = function getClientForHub (hub) {
}
}

Universe.prototype.shutdown = function shutdown () {
debug('Shutdown universe')
var self = this

self._discover.stop()
Object
.keys(self._clients)
.map(function (key) { return self._clients[key] })
.forEach(function (client) { client.close() })
}

module.exports = Universe

0 comments on commit 4171c32

Please sign in to comment.