From 6292303a31e9098e8803c9544fc0785023d526fd Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 13 Mar 2020 10:49:42 +0100 Subject: Fix message duplication due to a race-condition --- server.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'server.go') diff --git a/server.go b/server.go index b982e15..1654971 100644 --- a/server.go +++ b/server.go @@ -165,6 +165,10 @@ func handleTxnEvent(e *mxlib.Event) error { if acct != nil { ev.Author = acct.Conn.User() ev.Room = room.RoomID + + dbLockSlot(e.RoomId) + defer dbUnlockSlot(e.RoomId) + created_ev_id, err := acct.Conn.Send(ev) if err == nil && created_ev_id != "" { cache_key := fmt.Sprintf("%s/event_seen/%s/%s", -- cgit v1.2.3