Skip to content

Commit

Permalink
fixing double lock
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmenendez committed Nov 10, 2023
1 parent a47567f commit 22532c3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ func CreateAndPublishCensus(
if err != nil {
return nil, "", nil, err
}
db.Lock()
defer db.Unlock()
if err := db.Del(bID); err != nil {
return nil, "", nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion api/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func TestCreateAndPublish(t *testing.T) {
c.Assert(db.ImportTree(bID, dump), qt.IsNil)
// load the tree by id
ref, err := db.Load(bID, nil)
defer db.UnLoad()
c.Assert(err, qt.IsNil)
// check the root
importedRoot, err := ref.Tree().Root()
Expand All @@ -80,5 +81,4 @@ func TestCreateAndPublish(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(bytes.Equal(value, val), qt.IsTrue)
}
db.UnLoad()
}

0 comments on commit 22532c3

Please sign in to comment.