You've already forked matrix-js-sdk
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user