Change mutex logic
This commit is contained in:
parent
2e20380ecd
commit
1b5b461c9b
@ -123,11 +123,11 @@ func (t *treeStorage) Heads() ([]string, error) {
|
||||
}
|
||||
|
||||
func (t *treeStorage) SetHeads(heads []string) (err error) {
|
||||
t.headsMx.Lock()
|
||||
defer t.headsMx.Unlock()
|
||||
defer func() {
|
||||
if err == nil {
|
||||
t.headsMx.Lock()
|
||||
t.heads = heads
|
||||
t.headsMx.Unlock()
|
||||
}
|
||||
}()
|
||||
payload := createHeadsPayload(heads)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user