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) {
|
func (t *treeStorage) SetHeads(heads []string) (err error) {
|
||||||
|
t.headsMx.Lock()
|
||||||
|
defer t.headsMx.Unlock()
|
||||||
defer func() {
|
defer func() {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.headsMx.Lock()
|
|
||||||
t.heads = heads
|
t.heads = heads
|
||||||
t.headsMx.Unlock()
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
payload := createHeadsPayload(heads)
|
payload := createHeadsPayload(heads)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user