diff --git a/services/horizon/internal/db2/history/account_loader.go b/services/horizon/internal/db2/history/account_loader.go index 33b1e328b6..fad6931d8a 100644 --- a/services/horizon/internal/db2/history/account_loader.go +++ b/services/horizon/internal/db2/history/account_loader.go @@ -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