mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Relax roomserver input transactional isolation (#2224)
* Don't force full transactional isolation on roomserver input * Set succeeded * Tweak `MissingAuthPrevEvents`
This commit is contained in:
parent
b8a97b6ee0
commit
fea8d152e7
8 changed files with 105 additions and 165 deletions
|
@ -674,6 +674,29 @@ func (d *Database) GetPublishedRooms(ctx context.Context) ([]string, error) {
|
|||
return d.PublishedTable.SelectAllPublishedRooms(ctx, nil, true)
|
||||
}
|
||||
|
||||
func (d *Database) MissingAuthPrevEvents(
|
||||
ctx context.Context, e *gomatrixserverlib.Event,
|
||||
) (missingAuth, missingPrev []string, err error) {
|
||||
authEventNIDs, err := d.EventNIDs(ctx, e.AuthEventIDs())
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("d.EventNIDs: %w", err)
|
||||
}
|
||||
for _, authEventID := range e.AuthEventIDs() {
|
||||
if _, ok := authEventNIDs[authEventID]; !ok {
|
||||
missingAuth = append(missingAuth, authEventID)
|
||||
}
|
||||
}
|
||||
|
||||
for _, prevEventID := range e.PrevEventIDs() {
|
||||
state, err := d.StateAtEventIDs(ctx, []string{prevEventID})
|
||||
if err != nil || len(state) == 0 || (!state[0].IsCreate() && state[0].BeforeStateSnapshotNID == 0) {
|
||||
missingPrev = append(missingPrev, prevEventID)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (d *Database) assignRoomNID(
|
||||
ctx context.Context, txn *sql.Tx,
|
||||
roomID string, roomVersion gomatrixserverlib.RoomVersion,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue