diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go index 4e5b73420..a1b094871 100644 --- a/roomserver/internal/input/input_latest_events.go +++ b/roomserver/internal/input/input_latest_events.go @@ -102,8 +102,8 @@ type latestEventsUpdater struct { // The eventID of the event that was processed before this one. lastEventIDSent string // The latest events in the room after processing this event. - oldLatest []types.StateAtEventAndReference - latest []types.StateAtEventAndReference + oldLatest types.StateAtEventAndReferences + latest types.StateAtEventAndReferences // The state entries removed from and added to the current state of the // room as a result of processing this event. They are sorted lists. removed []types.StateEntry @@ -126,7 +126,7 @@ func (u *latestEventsUpdater) doUpdateLatestEvents() error { // state snapshot from somewhere else, e.g. a federated room join, // then start with an empty set - none of the forward extremities // that we knew about before matter anymore. - u.oldLatest = []types.StateAtEventAndReference{} + u.oldLatest = types.StateAtEventAndReferences{} if !u.rewritesState { u.oldStateNID = u.updater.CurrentStateSnapshotNID() u.oldLatest = u.updater.LatestEvents() @@ -277,8 +277,8 @@ func (u *latestEventsUpdater) latestState() error { "room_id": u.event.RoomID(), "old_state_nid": u.oldStateNID, "new_state_nid": u.newStateNID, - "old_latest": u.oldLatest, - "new_latest": u.latest, + "old_latest": u.oldLatest.EventIDs(), + "new_latest": u.latest.EventIDs(), }).Errorf("Unexpected state deletion (removing %d events)", removed) } diff --git a/roomserver/types/types.go b/roomserver/types/types.go index cf12a3c1e..bc01ca33c 100644 --- a/roomserver/types/types.go +++ b/roomserver/types/types.go @@ -210,6 +210,14 @@ func (s StateAtEventAndReferences) Swap(a, b int) { s[a], s[b] = s[b], s[a] } +func (s StateAtEventAndReferences) EventIDs() string { + strs := make([]string, 0, len(s)) + for _, r := range s { + strs = append(strs, r.EventID) + } + return "[" + strings.Join(strs, " ") + "]" +} + // An Event is a gomatrixserverlib.Event with the numeric event ID attached. // It is when performing bulk event lookup in the database. type Event struct {