aboutsummaryrefslogtreecommitdiff
path: root/roomserver/internal/query
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-02-10 10:05:14 +0000
committerGitHub <noreply@github.com>2022-02-10 10:05:14 +0000
commit2782ae3d5635de4eaa4b8b4ca5b1a289745ba554 (patch)
tree83371bab910e166352cd947a70e3ffd6152ba265 /roomserver/internal/query
parent9130156b131ec5a1714f4a7f6e54f12657d655a1 (diff)
Fix fetching missing state (#2163)
* Check that we have a populated state snapshot when determining if we closed the gap * Do the same in the query API * Use HasState more opportunistically * Try to avoid falling down the hole of using a trustworthy but empty state snapshot for non-create events * Refactor missing state and make sure that we really solve the problem for the new event * Comments * Review comments * Tweak that check again * Tidy up that create check further * Fix build hopefully * Update sendOutliers to use OrderAuthAndStateEvents * Don't go out of bounds on missingEvents
Diffstat (limited to 'roomserver/internal/query')
-rw-r--r--roomserver/internal/query/query.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/roomserver/internal/query/query.go b/roomserver/internal/query/query.go
index 84553303..05cd686f 100644
--- a/roomserver/internal/query/query.go
+++ b/roomserver/internal/query/query.go
@@ -150,7 +150,7 @@ func (r *Queryer) QueryMissingAuthPrevEvents(
for _, prevEventID := range request.PrevEventIDs {
state, err := r.DB.StateAtEventIDs(ctx, []string{prevEventID})
- if err != nil || len(state) == 0 {
+ if err != nil || len(state) == 0 || (!state[0].IsCreate() && state[0].BeforeStateSnapshotNID == 0) {
response.MissingPrevEventIDs = append(response.MissingPrevEventIDs, prevEventID)
}
}