aboutsummaryrefslogtreecommitdiff
path: root/roomserver
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-08-24 14:03:06 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-08-24 14:03:06 +0100
commit522bd2999f605258e95565c6d648d2f7ea001ea4 (patch)
treeeef0a7fa0b718767ec346e353eb01fc945dd8afa /roomserver
parent78e5d05efc95c959b380d6ee4230f75885a597ad (diff)
Allow un-rejecting events on reprocessing
Diffstat (limited to 'roomserver')
-rw-r--r--roomserver/api/wrapper.go8
-rw-r--r--roomserver/storage/postgres/events_table.go2
-rw-r--r--roomserver/storage/sqlite3/events_table.go2
3 files changed, 10 insertions, 2 deletions
diff --git a/roomserver/api/wrapper.go b/roomserver/api/wrapper.go
index bc2f2817..8b031982 100644
--- a/roomserver/api/wrapper.go
+++ b/roomserver/api/wrapper.go
@@ -19,6 +19,7 @@ import (
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
+ "github.com/sirupsen/logrus"
)
// SendEvents to the roomserver The events are written with KindNew.
@@ -69,6 +70,13 @@ func SendEventWithState(
stateEventIDs[i] = stateEvents[i].EventID()
}
+ logrus.WithContext(ctx).WithFields(logrus.Fields{
+ "room_id": event.RoomID(),
+ "event_id": event.EventID(),
+ "outliers": len(ires),
+ "state_ids": len(stateEventIDs),
+ }).Infof("Submitting %q event to roomserver with state snapshot", event.Type())
+
ires = append(ires, InputRoomEvent{
Kind: kind,
Event: event,
diff --git a/roomserver/storage/postgres/events_table.go b/roomserver/storage/postgres/events_table.go
index e758837a..1e7ca766 100644
--- a/roomserver/storage/postgres/events_table.go
+++ b/roomserver/storage/postgres/events_table.go
@@ -74,7 +74,7 @@ const insertEventSQL = "" +
"INSERT INTO roomserver_events AS e (room_nid, event_type_nid, event_state_key_nid, event_id, reference_sha256, auth_event_nids, depth, is_rejected)" +
" VALUES ($1, $2, $3, $4, $5, $6, $7, $8)" +
" ON CONFLICT ON CONSTRAINT roomserver_event_id_unique DO UPDATE" +
- " SET is_rejected = $8 WHERE e.event_id = $4 AND e.is_rejected = FALSE" +
+ " SET is_rejected = $8 WHERE e.event_id = $4 AND e.is_rejected = TRUE" +
" RETURNING event_nid, state_snapshot_nid"
const selectEventSQL = "" +
diff --git a/roomserver/storage/sqlite3/events_table.go b/roomserver/storage/sqlite3/events_table.go
index b5cc84bc..950d03b0 100644
--- a/roomserver/storage/sqlite3/events_table.go
+++ b/roomserver/storage/sqlite3/events_table.go
@@ -50,7 +50,7 @@ const insertEventSQL = `
INSERT INTO roomserver_events (room_nid, event_type_nid, event_state_key_nid, event_id, reference_sha256, auth_event_nids, depth, is_rejected)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
ON CONFLICT DO UPDATE
- SET is_rejected = $8 WHERE is_rejected = 0
+ SET is_rejected = $8 WHERE is_rejected = 1
RETURNING event_nid, state_snapshot_nid;
`