mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-16 15:42:03 +00:00
feat: repair matcher candidates through redis projection
This commit is contained in:
@@ -49,6 +49,15 @@ func (p CandidateProjection) Snapshot(ctx context.Context, now time.Time) ([]dom
|
||||
}
|
||||
candidates, err := p.Index.Snapshot(ctx, now)
|
||||
if err == nil {
|
||||
// An empty index is indistinguishable from a Redis restart or a lost
|
||||
// keyspace. Rebuild from PostgreSQL before returning so queued players
|
||||
// are not hidden until the next enqueue mutation.
|
||||
if len(candidates) == 0 {
|
||||
if err := p.Repair(ctx, now); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return p.Index.Snapshot(ctx, now)
|
||||
}
|
||||
return candidates, nil
|
||||
}
|
||||
if err := p.Repair(ctx, now); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user