From c96870b9301f7ba58eefe287d1c901b4f7cb8d4f Mon Sep 17 00:00:00 2001 From: Tak Wai Wong Date: Tue, 13 Sep 2022 15:58:26 -0700 Subject: [PATCH] generate a different txnid --- appservice/consumers/roomserver.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appservice/consumers/roomserver.go b/appservice/consumers/roomserver.go index a4bcfa7d9..c24603903 100644 --- a/appservice/consumers/roomserver.go +++ b/appservice/consumers/roomserver.go @@ -173,9 +173,10 @@ func (s *OutputRoomEventConsumer) sendEvents( return err } - // TODO: We should probably be more intelligent and pick something not - // in the control of the event. A NATS timestamp header or something maybe. - txnID := events[0].Event.OriginServerTS() + // If the number of items in the array is different, + // then this should be a different transaction. Incorporate the length + // of events into the transaction ID. + txnID := events[0].Event.OriginServerTS().Time().Add(time.Duration(len(events))) // Send the transaction to the appservice. // https://matrix.org/docs/spec/application_service/r0.1.2#put-matrix-app-v1-transactions-txnid