1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Scrollback improvements

Add a 3s delay between scrollback requests if the previous scrollback request
failed.

Return the same promise if scrollback() is called multiple times whilst a
scrollback request is ongoing.
This commit is contained in:
Kegan Dougal
2015-12-04 17:27:16 +00:00
parent d16dfdaee3
commit 73e0216f78
2 changed files with 39 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ HttpBackend.prototype = {
var defer = q.defer();
var self = this;
var flushed = 0;
var triedWaiting = false;
console.log(
"HTTP backend flushing... (path=%s numToFlush=%s)", path, numToFlush
);
@@ -49,6 +50,12 @@ HttpBackend.prototype = {
setTimeout(tryFlush, 0);
}
}
else if (flushed === 0 && !triedWaiting) {
// we may not have made the request yet, wait a generous amount of
// time before giving up.
setTimeout(tryFlush, 5);
triedWaiting = true;
}
else {
console.log(" no more flushes. [%s]", path);
defer.resolve();