mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Simpler condition
This commit is contained in:
parent
e4852eea09
commit
6c1848066d
1 changed files with 4 additions and 9 deletions
|
@ -82,18 +82,13 @@ func (r *Backfiller) PerformBackfill(
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve events from the list that was filled previously.
|
// Retrieve events from the list that was filled previously. If we fail to get
|
||||||
|
// events from the database then attempt once to get them from federation instead.
|
||||||
var loadedEvents []*gomatrixserverlib.Event
|
var loadedEvents []*gomatrixserverlib.Event
|
||||||
var retried bool
|
|
||||||
retryLoadEvents:
|
|
||||||
loadedEvents, err = helpers.LoadEvents(ctx, r.DB, resultNIDs)
|
loadedEvents, err = helpers.LoadEvents(ctx, r.DB, resultNIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if _, ok := err.(types.MissingEventError); !retried && ok {
|
if _, ok := err.(types.MissingEventError); ok {
|
||||||
err = r.backfillViaFederation(ctx, request, response)
|
return r.backfillViaFederation(ctx, request, response)
|
||||||
if err == nil {
|
|
||||||
retried = true
|
|
||||||
goto retryLoadEvents
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue