Skip to content

Commit

Permalink
do send SUBSCRIPTION_HAS_PROVIDER only for records
Browse files Browse the repository at this point in the history
  • Loading branch information
timaschew committed Aug 11, 2016
1 parent 6390bab commit 3f647dc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/listen/listener-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class ListenerRegistry {
}

// stop providing
this._sendHasProviderUpdate( false, this._type, subscriptionName );
this._sendHasProviderUpdate( false, subscriptionName );
provider.socketWrapper.send(
messageBuilder.getMsg(
this._type, C.ACTIONS.SUBSCRIPTION_FOR_PATTERN_REMOVED, [ provider.pattern, subscriptionName ]
Expand Down Expand Up @@ -219,7 +219,7 @@ class ListenerRegistry {
pattern: message.data[ 0 ]
}

this._sendHasProviderUpdate( true, this._type, subscriptionName );
this._sendHasProviderUpdate( true, subscriptionName );
}

/**
Expand Down Expand Up @@ -339,7 +339,7 @@ class ListenerRegistry {
const provider = this._providedRecords[ subscriptionName ];
if( provider && provider.socketWrapper === socketWrapper) {
delete this._providedRecords[ subscriptionName ];
this._sendHasProviderUpdate( false, this._type, subscriptionName );
this._sendHasProviderUpdate( false, subscriptionName );
this._createListenMap( subscriptionName );
this._triggerNextProvider( subscriptionName );
}
Expand All @@ -351,8 +351,11 @@ class ListenerRegistry {
* @private
* @returns {Message}
*/
_sendHasProviderUpdate( hasProvider, type, subscriptionName ) {
this._clientRegistry.sendToSubscribers( subscriptionName, this._createHasProviderMessage( hasProvider, this._type, subscriptionName ) );
_sendHasProviderUpdate( hasProvider, subscriptionName ) {
if( this._type !== C.TOPIC.RECORD ) {
return
}
this._clientRegistry.sendToSubscribers( subscriptionName, this._createHasProviderMessage( hasProvider, this._type, subscriptionName ) );
}

/**
Expand Down

0 comments on commit 3f647dc

Please sign in to comment.