Skip to content

Commit 925a119

Browse files
committed
Fix duplicate keyper set error
On startup, the chainsyncer gives all keyper sets it can find in the keyper set manager to its subscribers, no matter if they are actually new or already in the db. This results in duplicate primary key errors when we try to insert them a second time. To fix this, the SQL query now does not insert the keyper set if it is already present.
1 parent 5fcb8af commit 925a119

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

rolling-shutter/chainobserver/db/keyper/keyper.sqlc.gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rolling-shutter/chainobserver/db/keyper/sql/queries/keyper.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ INSERT INTO keyper_set (
66
threshold
77
) VALUES (
88
$1, $2, $3, $4
9-
);
9+
) ON CONFLICT DO NOTHING;
1010

1111
-- name: GetKeyperSetByKeyperConfigIndex :one
1212
SELECT * FROM keyper_set WHERE keyper_config_index=$1;

0 commit comments

Comments
 (0)