1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2026-01-03 23:22:30 +03:00

Include a counter in generated transaction IDs

Fixes a flaky test which sometimes failed due to sending two events in the same
millisecond.
This commit is contained in:
Richard van der Hoff
2016-03-18 21:32:15 +00:00
parent e15a2d138c
commit dfc4b34d09

View File

@@ -183,7 +183,7 @@ function MatrixClient(opts) {
this._peekSync = null;
this._isGuest = false;
this._ongoingScrollbacks = {};
this._txnCtr = 0;
this.timelineSupport = Boolean(opts.timelineSupport);
}
utils.inherits(MatrixClient, EventEmitter);
@@ -937,7 +937,7 @@ MatrixClient.prototype.sendEvent = function(roomId, eventType, content, txnId,
if (utils.isFunction(txnId)) { callback = txnId; txnId = undefined; }
if (!txnId) {
txnId = "m" + new Date().getTime();
txnId = "m" + new Date().getTime() + "." + (this._txnCtr++);
}
// we always construct a MatrixEvent when sending because the store and