mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-01-30 23:54:27 -06:00
Minor bug fixes with latest event updater
This commit is contained in:
parent
31cc9be470
commit
9a2210495b
|
@ -405,7 +405,7 @@ func (u *latestEventsUpdater) extraEventsForIDs(roomVersion gomatrixserverlib.Ro
|
|||
if len(extraEventIDs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
extraEvents, err := u.api.DB.EventsFromIDs(u.ctx, extraEventIDs)
|
||||
extraEvents, err := u.updater.EventsFromIDs(u.ctx, extraEventIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ func (u *latestEventsUpdater) stateEventMap() (map[types.EventNID]string, error)
|
|||
stateEventNIDs = append(stateEventNIDs, entry.EventNID)
|
||||
}
|
||||
stateEventNIDs = stateEventNIDs[:util.SortAndUnique(eventNIDSorter(stateEventNIDs))]
|
||||
return u.api.DB.EventIDs(u.ctx, stateEventNIDs)
|
||||
return u.updater.EventIDs(u.ctx, stateEventNIDs)
|
||||
}
|
||||
|
||||
type eventNIDSorter []types.EventNID
|
||||
|
|
|
@ -181,6 +181,12 @@ func (u *RoomUpdater) RoomInfo(ctx context.Context, roomID string) (*types.RoomI
|
|||
return u.d.roomInfo(ctx, u.txn, roomID)
|
||||
}
|
||||
|
||||
func (u *RoomUpdater) EventIDs(
|
||||
ctx context.Context, eventNIDs []types.EventNID,
|
||||
) (map[types.EventNID]string, error) {
|
||||
return u.d.EventsTable.BulkSelectEventID(ctx, u.txn, eventNIDs)
|
||||
}
|
||||
|
||||
func (u *RoomUpdater) StateAtEventIDs(
|
||||
ctx context.Context, eventIDs []string,
|
||||
) ([]types.StateAtEvent, error) {
|
||||
|
|
|
@ -93,7 +93,8 @@ func (s *stateBlockStatements) BulkInsertStateData(
|
|||
if err != nil {
|
||||
return 0, fmt.Errorf("json.Marshal: %w", err)
|
||||
}
|
||||
err = s.insertStateDataStmt.QueryRowContext(
|
||||
stmt := sqlutil.TxStmt(txn, s.insertStateDataStmt)
|
||||
err = stmt.QueryRowContext(
|
||||
ctx, nids.Hash(), js,
|
||||
).Scan(&id)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue