Skip to content

Commit

Permalink
copyTrees: add timeouts and order to sync function (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
worm-emoji authored Jun 22, 2023
1 parent 6af5137 commit 63acbae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ func check(err error) {
}

func copyTrees(ctx context.Context, db *pgxpool.Pool) {
ctx, done := context.WithTimeout(ctx, 5*time.Minute)
defer done()
t, err := db.Exec(ctx, `
insert into trees_proofs
(select root, proofs from trees
where root not in (select root from trees_proofs)
order by inserted_at desc
limit 5
for update skip locked)
`)
Expand Down

1 comment on commit 63acbae

@vercel
Copy link

@vercel vercel bot commented on 63acbae Jun 22, 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-production.mf.dev
lanyard-git-main.mf.dev
lanyard.mf.dev

Please sign in to comment.