From db3e3ade80069da53ff66567a96d0f85a2fd4748 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 23 Jun 2014 11:52:13 +0200 Subject: [PATCH] No need to hold a write lock in Override --- model/model.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/model/model.go b/model/model.go index 8771fd1b3..315bb5a5a 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) }