From c671a7ad87723123746646ff3301124a9af5062c Mon Sep 17 00:00:00 2001 From: tamirms Date: Thu, 15 Aug 2024 11:30:56 +0100 Subject: [PATCH] change order to fix race condition with reaper --- services/horizon/internal/db2/history/account_loader.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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