Skip to content

Commit

Permalink
copyTrees: use for update skip locked to avoid deadlocks (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
worm-emoji committed Jun 14, 2023
1 parent fc31983 commit 7a6f264
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ func copyTrees(ctx context.Context, db *pgxpool.Pool) {
t, err := db.Exec(ctx, `
insert into trees_proofs
(select root, proofs from trees
where root not in (select root from trees_proofs))
where root not in (select root from trees_proofs)
limit 5
for update skip locked)
`)

if err != nil {
Expand Down

1 comment on commit 7a6f264

@vercel
Copy link

@vercel vercel bot commented on 7a6f264 Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lanyard – ./

lanyard.mf.dev
lanyard-production.mf.dev
lanyard-git-main.mf.dev

Please sign in to comment.