mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-18 11:33:10 -06:00
Assing stateKeyNID if we don't have the expected count
This commit is contained in:
parent
efa50253f6
commit
f802598abb
|
|
@ -110,6 +110,19 @@ func (d *Database) eventStateKeyNIDs(
|
|||
for eventStateKey, nid := range nids {
|
||||
result[eventStateKey] = nid
|
||||
}
|
||||
// We received some nids, but are still missing some, work out which and create them
|
||||
if len(eventStateKeys) < len(result) {
|
||||
for _, eventStateKey := range eventStateKeys {
|
||||
if _, ok := result[eventStateKey]; ok {
|
||||
continue
|
||||
}
|
||||
nid, err := d.assignStateKeyNID(ctx, txn, eventStateKey)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
result[eventStateKey] = nid
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue