mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-09 15:13:12 -06:00
More input tweaks
This commit is contained in:
parent
175989e363
commit
8048c77526
|
|
@ -62,6 +62,7 @@ import (
|
|||
//
|
||||
// A BC * -> positions of each consumer (* = ephemeral)
|
||||
// ⌄ ⌄⌄ ⌄
|
||||
//
|
||||
// ABAABCAABCAA -> newest (letter = subject for each message)
|
||||
//
|
||||
// In this example, A is still processing an event but has two
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ func (r *Inputer) processRoomEvent(
|
|||
return fmt.Errorf("r.DB.RoomInfo: %w", rerr)
|
||||
}
|
||||
isCreateEvent := event.Type() == gomatrixserverlib.MRoomCreate && event.StateKeyEquals("")
|
||||
if roomInfo == nil && !isCreateEvent {
|
||||
if !isCreateEvent && (roomInfo == nil || roomInfo.IsStub()) {
|
||||
return fmt.Errorf("room %s does not exist for event %s", event.RoomID(), event.EventID())
|
||||
}
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ func (r *Inputer) processRoomEvent(
|
|||
if err != nil {
|
||||
return fmt.Errorf("updater.RoomInfo: %w", err)
|
||||
}
|
||||
if roomInfo == nil {
|
||||
if roomInfo == nil || (!isCreateEvent && roomInfo.IsStub()) {
|
||||
return fmt.Errorf("updater.RoomInfo missing for room %s", event.RoomID())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ func (d *Database) roomInfo(ctx context.Context, txn *sql.Tx, roomID string) (*t
|
|||
}
|
||||
// Otherwise, try to admit the data into the cache and return the
|
||||
// new reference from the database.
|
||||
if roomInfoFromDB != nil {
|
||||
if err == nil && roomInfoFromDB != nil {
|
||||
d.Cache.StoreRoomInfo(roomID, roomInfoFromDB)
|
||||
d.Cache.StoreRoomServerRoomID(roomInfoFromDB.RoomNID, roomID)
|
||||
}
|
||||
|
|
@ -842,6 +842,7 @@ func extractRoomVersionFromCreateEvent(event *gomatrixserverlib.Event) (
|
|||
// These cases are:
|
||||
// - This is a redaction event, redact the event it references if we know about it.
|
||||
// - This is a normal event which may have been previously redacted.
|
||||
//
|
||||
// In the first case, check if we have the referenced event then apply the redaction, else store it
|
||||
// in the redactions table with validated=FALSE. In the second case, check if there is a redaction for it:
|
||||
// if there is then apply the redactions and set validated=TRUE.
|
||||
|
|
|
|||
Loading…
Reference in a new issue