mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-29 17:51:56 -06:00
Make logging output for state deletions a bit better
This commit is contained in:
parent
015465d496
commit
9eb4fec33b
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue