Skip to content

Commit 2a8f6a1

Browse files
committed
- addressing issue #11 - Pubsub.prototype.unsubscribe race condition
1 parent aa24b74 commit 2a8f6a1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/core/Pubsub.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ function Pubsub(url, options){
4444
catch (e){
4545
(DEBUG && console.log('[Pubsub:'+self.id+'] Received Raw Buffer ('+message.length+')'));
4646
}
47-
48-
self.handlers[topic](message, topic);
47+
48+
try {
49+
self.handlers[topic](message, topic);
50+
}
51+
catch (e){
52+
console.log(chalk.red('[Pubsub:'+self.id+'] WARNING: ')+'Handler not found for <'+topic+'>');
53+
}
4954
});
5055

5156
if (options && options.handlers){

0 commit comments

Comments
 (0)