File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,9 @@ class Publisher {
3939
4040class Subscriber extends events . EventEmitter {
4141
42- constructor ( ) {
42+ constructor ( options ) {
4343 super ( ) ;
44+ this . disableFanOut = options . disableFanOut || false ;
4445 }
4546
4647 subscribe ( channel ) {
@@ -72,9 +73,13 @@ class Subscriber extends events.EventEmitter {
7273 }
7374
7475 _createSubscription ( topic , channel ) {
75-
76- const subscriptionUUID = uuid . v1 ( ) ;
77- var subscriptionName = `${ namePrefix } -${ channel } -${ subscriptionUUID } ` ;
76+ let subscriptionName ;
77+ if ( ! this . disableFanOut ) {
78+ const subscriptionUUID = uuid . v1 ( ) ;
79+ subscriptionName = `${ namePrefix } -${ channel } -${ subscriptionUUID } ` ;
80+ } else {
81+ subscriptionName = `${ namePrefix } -${ channel } ` ;
82+ }
7883
7984 topic . subscribe ( subscriptionName , ( err , subscription ) => {
8085
@@ -140,8 +145,8 @@ function createPublisher() {
140145 return new Publisher ( emitter ) ;
141146}
142147
143- function createSubscriber ( ) {
144- return new Subscriber ( ) ;
148+ function createSubscriber ( options ) {
149+ return new Subscriber ( options ) ;
145150}
146151
147152module . exports = {
You can’t perform that action at this time.
0 commit comments