mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
Improve variable name?
This commit is contained in:
parent
9b9da2a8e9
commit
32bc415472
@ -433,7 +433,9 @@ func (a *Accumulator) Accumulate(txn *sqlx.Tx, userID, roomID string, timeline s
|
||||
}
|
||||
|
||||
var latestNID int64
|
||||
newEventsByID := make([]Event, 0, len(eventIDToNID))
|
||||
// postInsertEvents matches newEvents, but a) it has NIDs, and b) state events have
|
||||
// the IsState field hacked to true so we don't insert them into the timeline.
|
||||
postInsertEvents := make([]Event, 0, len(eventIDToNID))
|
||||
redactTheseEventIDs := make(map[string]*Event)
|
||||
for i, ev := range newEvents {
|
||||
nid, ok := eventIDToNID[ev.ID]
|
||||
@ -461,7 +463,7 @@ func (a *Accumulator) Accumulate(txn *sqlx.Tx, userID, roomID string, timeline s
|
||||
redactTheseEventIDs[redactsEventID] = &newEvents[i]
|
||||
}
|
||||
}
|
||||
newEventsByID = append(newEventsByID, ev)
|
||||
postInsertEvents = append(postInsertEvents, ev)
|
||||
result.TimelineNIDs = append(result.TimelineNIDs, ev.NID)
|
||||
}
|
||||
}
|
||||
@ -487,7 +489,7 @@ func (a *Accumulator) Accumulate(txn *sqlx.Tx, userID, roomID string, timeline s
|
||||
}
|
||||
}
|
||||
|
||||
for _, ev := range newEventsByID {
|
||||
for _, ev := range postInsertEvents {
|
||||
var replacesNID int64
|
||||
// the snapshot ID we assign to this event is unaffected by whether /this/ event is state or not,
|
||||
// as this is the before snapshot ID.
|
||||
@ -543,12 +545,12 @@ func (a *Accumulator) Accumulate(txn *sqlx.Tx, userID, roomID string, timeline s
|
||||
result.RequiresReload = currentStateRedactions > 0
|
||||
}
|
||||
|
||||
if err = a.spacesTable.HandleSpaceUpdates(txn, newEventsByID); err != nil {
|
||||
if err = a.spacesTable.HandleSpaceUpdates(txn, postInsertEvents); err != nil {
|
||||
return AccumulateResult{}, fmt.Errorf("HandleSpaceUpdates: %s", err)
|
||||
}
|
||||
|
||||
// the last fetched snapshot ID is the current one
|
||||
info := a.roomInfoDelta(roomID, newEventsByID)
|
||||
info := a.roomInfoDelta(roomID, postInsertEvents)
|
||||
if err = a.roomsTable.Upsert(txn, info, snapID, latestNID); err != nil {
|
||||
return AccumulateResult{}, fmt.Errorf("failed to UpdateCurrentSnapshotID to %d: %w", snapID, err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user