Skip to content

Commit

Permalink
censusdb: fix deadlock
Browse files Browse the repository at this point in the history
Signed-off-by: p4u <[email protected]>
  • Loading branch information
p4u committed Nov 13, 2023
1 parent 83844f1 commit 1984f32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/censuses.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,9 @@ func (a *API) censusPublishHandler(msg *apirest.APIdata, ctx *httprouter.HTTPCon

// if the census already exists, return the URI and the root
if a.censusdb.Exists(root) {
a.censusdb.UnLoad()
// note that there is already a UnLoad call set on defer
ref, err := a.censusdb.Load(root, nil)
defer a.censusdb.UnLoad()
if err != nil {
if errors.Is(err, censusdb.ErrCensusNotFound) {
return ErrCensusNotFound
Expand Down

0 comments on commit 1984f32

Please sign in to comment.