diff options
author | Jakob Borg <jakob@nym.se> | 2014-06-23 11:52:13 +0200 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2014-06-23 11:52:13 +0200 |
commit | db3e3ade80069da53ff66567a96d0f85a2fd4748 (patch) | |
tree | 9f1efa571ef0469cf11b0443e1af192083b8a74e | |
parent | e6f04ed238fb8664e9f5bbf80387ed2aaca7f1d8 (diff) |
No need to hold a write lock in Override
-rw-r--r-- | model/model.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/model/model.go b/model/model.go index 8771fd1b32..315bb5a5a7 100644 --- a/model/model.go +++ b/model/model.go @@ -858,8 +858,10 @@ func (m *Model) State(repo string) string { func (m *Model) Override(repo string) { fs := m.NeedFilesRepo(repo) - m.rmut.Lock() + m.rmut.RLock() r := m.repoFiles[repo] + m.rmut.RUnlock() + for i := range fs { f := &fs[i] h := r.Get(cid.LocalID, f.Name) @@ -873,7 +875,6 @@ func (m *Model) Override(repo string) { } f.Version = lamport.Default.Tick(f.Version) } - m.rmut.Unlock() r.Update(cid.LocalID, fs) } |