Remove RPC queueing now that we're doing client-side client_id generation.

This commit is contained in:
Ian Gulliver
2014-06-01 13:41:45 -07:00
parent fd5569c5dc
commit b84b733e56

View File

@@ -75,11 +75,6 @@ var Cosmopolite = function(
*/
this.shutdown_ = false;
/**
* @type {Array.<Object>}
* @private
*/
this.rpcQueue_ = [];
/**
* @type {Object.<string, Cosmopolite.typeSubscription_>}
* @private
@@ -100,6 +95,9 @@ var Cosmopolite = function(
localStorage[this.namespace_ + ':client_id'] = this.uuid_();
}
/** @type {string} */
this.instanceID_ = this.uuid_();
/**
* @type {string}
* @private
@@ -728,12 +726,7 @@ Cosmopolite.prototype.sendRPC_ = function(command, args, opt_onSuccess) {
'arguments': args,
'onSuccess': opt_onSuccess || null
};
if (this.maySendRPC_()) {
this.sendRPCs_([rpc]);
} else {
// Queue instead of sending.
this.rpcQueue_.push(rpc);
}
this.sendRPCs_([rpc]);
};
@@ -843,35 +836,14 @@ Cosmopolite.prototype.sendRPCs_ = function(commands, opt_delay) {
};
/**
* Are we currently clear to put RPCs on the wire?
*
* @return {boolean}
* @const
* @private
*/
Cosmopolite.prototype.maySendRPC_ = function() {
if (this.channelState_ != Cosmopolite.ChannelState_.OPEN) {
return false;
}
return true;
};
/**
* Handle tasks needed after reconnecting the channel
*
* @private
*/
Cosmopolite.prototype.onReconnect_ = function() {
if (!this.maySendRPC_()) {
return;
}
/** @type {Array.<Cosmopolite.typeRPC_>} */
var rpcs = this.rpcQueue_;
this.rpcQueue_ = [];
var rpcs = [];
for (var subject in this.subscriptions_) {
/** @type {Cosmopolite.typeSubscription_} */
var subscription = this.subscriptions_[subject];
@@ -915,9 +887,6 @@ Cosmopolite.prototype.createChannel_ = function() {
return;
}
/** @type {string} */
this.instanceID_ = this.uuid_();
var rpcs = [
{
'command': 'createChannel',
@@ -1015,6 +984,8 @@ Cosmopolite.prototype.onSocketClose_ = function() {
}, this);
}
this.instanceID_ = this.uuid_();
this.createChannel_();
};