Skip to content

Commit

Permalink
change order to fix race condition with reaper
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Aug 27, 2024
1 parent 4f36d70 commit 93be300
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions services/horizon/internal/db2/history/account_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ func (l *loader[K, T]) Exec(ctx context.Context, session db.SessionInterface) er
return l.less(keys[i], keys[j])
})

if count, err := l.insert(ctx, q, keys); err != nil {
if count, err := l.query(ctx, q, keys); err != nil {
return err
} else {
l.stats.Total += count
l.stats.Inserted += count
}

if count, err := l.query(ctx, q, keys); err != nil {
if count, err := l.insert(ctx, q, keys); err != nil {
return err
} else {
l.stats.Total += count
l.stats.Inserted += count
}

return nil
Expand Down

0 comments on commit 93be300

Please sign in to comment.