Performance improvement by using strict equality, fixed heartbeat issue in connection stage
This commit is contained in:
@@ -22,21 +22,21 @@ util.inherits(VolatileSubscriptionOperation, SubscriptionOperation);
|
||||
VolatileSubscriptionOperation.prototype._createSubscriptionPackage = function() {
|
||||
var dto = new ClientMessage.SubscribeToStream(this._streamId, this._resolveLinkTos);
|
||||
return new TcpPackage(TcpCommand.SubscribeToStream,
|
||||
this._userCredentials != null ? TcpFlags.Authenticated : TcpFlags.None,
|
||||
this._userCredentials !== null ? TcpFlags.Authenticated : TcpFlags.None,
|
||||
this._correlationId,
|
||||
this._userCredentials != null ? this._userCredentials.username : null,
|
||||
this._userCredentials != null ? this._userCredentials.password : null,
|
||||
this._userCredentials !== null ? this._userCredentials.username : null,
|
||||
this._userCredentials !== null ? this._userCredentials.password : null,
|
||||
new BufferSegment(dto.toBuffer()));
|
||||
};
|
||||
|
||||
VolatileSubscriptionOperation.prototype._inspectPackage = function(pkg) {
|
||||
try {
|
||||
if (pkg.command == TcpCommand.SubscriptionConfirmation) {
|
||||
if (pkg.command === TcpCommand.SubscriptionConfirmation) {
|
||||
var dto = ClientMessage.SubscriptionConfirmation.decode(pkg.data.toBuffer());
|
||||
this._confirmSubscription(dto.last_commit_position, dto.last_event_number);
|
||||
return new InspectionResult(InspectionDecision.Subscribed, "SubscriptionConfirmation");
|
||||
}
|
||||
if (pkg.command == TcpCommand.StreamEventAppeared) {
|
||||
if (pkg.command === TcpCommand.StreamEventAppeared) {
|
||||
var dto = ClientMessage.StreamEventAppeared.decode(pkg.data.toBuffer());
|
||||
this._onEventAppeared(new results.ResolvedEvent(dto.event));
|
||||
return new InspectionResult(InspectionDecision.DoNothing, "StreamEventAppeared");
|
||||
|
Reference in New Issue
Block a user