1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Review comments

This commit is contained in:
Kegan Dougal
2017-02-16 11:28:51 +00:00
parent b02ba08abc
commit 9a9646d012
7 changed files with 45 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -508,9 +509,6 @@ SyncApi.prototype._sync = function(syncOptions) {
qps.timeout = 0;
}
// normal timeout= plus buffer time
const clientSideTimeoutMs = this.opts.pollTimeout + BUFFER_PERIOD_MS;
let isCachedResponse = false;
if (self.opts.syncAccumulator && !syncOptions.hasSyncedBefore) {
let data = self.opts.syncAccumulator.getJSON();
@@ -520,7 +518,7 @@ SyncApi.prototype._sync = function(syncOptions) {
debuglog("sync(): not doing HTTP hit, instead returning stored /sync data");
// We must deep copy the stored data so that the /sync processing code doesn't
// corrupt the internal state of the sync accumulator (it adds non-clonable keys)
data = JSON.parse(JSON.stringify(data));
data = utils.deepCopy(data);
this._currentSyncRequest = q.resolve({
next_batch: data.nextBatch,
rooms: data.roomsData,
@@ -529,6 +527,9 @@ SyncApi.prototype._sync = function(syncOptions) {
}
}
// normal timeout= plus buffer time
const clientSideTimeoutMs = this.opts.pollTimeout + BUFFER_PERIOD_MS;
if (!isCachedResponse) {
debuglog('Starting sync since=' + syncToken);
this._currentSyncRequest = client._http.authedRequest(