diff --git a/spec/integ/sliding-sync.spec.ts b/spec/integ/sliding-sync.spec.ts index cc7a1d0dd..8c4a7ad12 100644 --- a/spec/integ/sliding-sync.spec.ts +++ b/spec/integ/sliding-sync.spec.ts @@ -584,7 +584,7 @@ describe("SlidingSync", () => { let txnId; httpBackend.when("POST", syncUrl).check(function(req) { const body = req.data; - logger.log("txn got ", body); + logger.debug("got ", body); expect(body.room_subscriptions).toBeTruthy(); expect(body.room_subscriptions[roomId]).toEqual(roomSubInfo); expect(body.txn_id).toBeTruthy(); @@ -616,7 +616,7 @@ describe("SlidingSync", () => { let txnId; httpBackend.when("POST", syncUrl).check(function(req) { const body = req.data; - logger.log("txn got ", body); + logger.debug("got ", body); expect(body.room_subscriptions).toBeFalsy(); expect(body.lists[0]).toEqual(newList); expect(body.txn_id).toBeTruthy(); @@ -638,7 +638,7 @@ describe("SlidingSync", () => { let txnId; httpBackend.when("POST", syncUrl).check(function(req) { const body = req.data; - logger.log("txn got ", body); + logger.debug("got ", body); expect(body.room_subscriptions).toBeFalsy(); expect(body.lists[0]).toEqual({ ranges: [[20, 40]], @@ -664,7 +664,7 @@ describe("SlidingSync", () => { let txnId; httpBackend.when("POST", syncUrl).check(function(req) { const body = req.data; - logger.log("txn got ", body); + logger.debug("got ", body); expect(body.room_subscriptions).toBeTruthy(); expect(body.room_subscriptions[roomId]).toEqual({ timeline_limit: 99, @@ -759,7 +759,7 @@ describe("SlidingSync", () => { let txnId; httpBackend.when("POST", syncUrl).check(function(req) { const body = req.data; - logger.log("txn got ", body); + logger.debug("got ", body); expect(body.room_subscriptions).toBeFalsy(); expect(body.lists[0]).toEqual({ ranges: [[20, 40]], diff --git a/src/sliding-sync.ts b/src/sliding-sync.ts index 9d5cefe02..28026b3a9 100644 --- a/src/sliding-sync.ts +++ b/src/sliding-sync.ts @@ -639,6 +639,10 @@ export class SlidingSync extends TypedEventEmitter { + if (this.needsResend && this.txnIdDefers.length > 0) { + // we already have a resend queued, so just return the same promise + return this.txnIdDefers[this.txnIdDefers.length-1].promise; + } this.needsResend = true; this.txnId = this.client.makeTxnId(); const d = defer(); @@ -671,9 +675,7 @@ export class SlidingSync extends TypedEventEmitter