aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'account.go')
-rw-r--r--account.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/account.go b/account.go
index b0313a4..0b480d6 100644
--- a/account.go
+++ b/account.go
@@ -453,17 +453,16 @@ func (a *Account) eventInternal(event *Event) error {
var cache_key string
if event.Id != "" {
+ // Use mx_room_id as a lock slot key, because this section is
+ // concurrent with the part that sends events out in server.go,
+ // and at that point we don't know the event's ID yet
+ // since it will be attributed by the backend during the call to send
dbLockSlot(mx_room_id)
defer dbUnlockSlot(mx_room_id)
// If the event has an ID, make sure it is processed only once
cache_key = fmt.Sprintf("%s/event_seen/%s/%s",
a.Protocol, mx_room_id, event.Id)
- slot_key := dbKvSlotKey(cache_key)
-
- dbLockSlot(slot_key)
- defer dbUnlockSlot(slot_key)
-
if dbKvGet(cache_key) == "yes" {
// false: cache key was not modified, meaning we
// already saw the event