Properly update repo consistency metadata

Previously these two queries did nothing at all -_-

Note that this will trigger a full re-index of every repo seen on the
firehose.
main
Max Ignatenko 2024-03-13 10:36:41 +00:00
parent 080cbb8b12
commit 57aa4731e5
1 changed files with 2 additions and 2 deletions

View File

@ -358,7 +358,7 @@ func (c *Consumer) processMessage(ctx context.Context, typ string, r io.Reader,
if payload.TooBig { if payload.TooBig {
// Just trigger a re-index by resetting rev. // Just trigger a re-index by resetting rev.
err := c.db.Model(r).Where(&repo.Repo{ID: repoInfo.ID}). err := c.db.Model(&repo.Repo{}).Where(&repo.Repo{ID: repoInfo.ID}).
Updates(&repo.Repo{ Updates(&repo.Repo{
FirstCursorSinceReset: c.remote.FirstCursorSinceReset, FirstCursorSinceReset: c.remote.FirstCursorSinceReset,
FirstRevSinceReset: payload.Rev, FirstRevSinceReset: payload.Rev,
@ -369,7 +369,7 @@ func (c *Consumer) processMessage(ctx context.Context, typ string, r io.Reader,
} }
if repoInfo.FirstCursorSinceReset != c.remote.FirstCursorSinceReset { if repoInfo.FirstCursorSinceReset != c.remote.FirstCursorSinceReset {
err := c.db.Model(r).Where(&repo.Repo{ID: repoInfo.ID}). err := c.db.Model(&repo.Repo{}).Debug().Where(&repo.Repo{ID: repoInfo.ID}).
Updates(&repo.Repo{ Updates(&repo.Repo{
FirstCursorSinceReset: c.remote.FirstCursorSinceReset, FirstCursorSinceReset: c.remote.FirstCursorSinceReset,
FirstRevSinceReset: payload.Rev, FirstRevSinceReset: payload.Rev,