Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed 'end' method. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,17 @@ Adapter.prototype.connect = function(cb) {
}

Adapter.prototype.end = function(cb) {
this.pubClient.end();
this.subClient.end();
// redis client doesn't offer a callback arg
// or return any way to determine success, so we
// wrap this call in a try/catch block
try {
this.redisPubClient.end();
this.redisSubClient.end();
cb();
} catch(e) {
// this is unlikely / impossible?
cb(e);
}
}

/**
Expand Down Expand Up @@ -101,9 +110,9 @@ Adapter.prototype.publish = function(topic, message, options, cb) {
*
* @callback {Function} callback Called once the adapter has finished subscribing.
* @param {Error} err An error object is included if an error was supplied by the adapter.
* @param {Object[]} granted An array of topics granted formatted as an object `{topic: 't', qos: n}`.
* @param {String} granted[n].topic The topic granted
* @param {String} granted[n].qos The qos for the topic
* @param {Object[]} granted An array of topics granted formatted as an object `{topic: 't', qos: n}`.
* @param {String} granted[n].topic The topic granted
* @param {String} granted[n].qos The qos for the topic
*/

Adapter.prototype.subscribe = function(topic, options, cb) {
Expand Down