Skip to content

Commit

Permalink
lock pre-existing rows
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms committed Aug 15, 2024
1 parent 94db9f5 commit cbfed4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion services/horizon/internal/db2/history/account_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ func bulkGet(ctx context.Context, q *Q, table string, fields []columnValues, res
pq.Array(field.objects),
)
}
lockSuffix := "ORDER BY id ASC FOR KEY SHARE"
sql := `SELECT * FROM ` + table + ` WHERE (` + strings.Join(columns, ",") + `) IN
(SELECT ` + strings.Join(unnestPart, ",") + `)`
(SELECT ` + strings.Join(unnestPart, ",") + `) ` + lockSuffix

return q.SelectRaw(
ctx,
Expand Down

0 comments on commit cbfed4b

Please sign in to comment.