No need to hold a write lock in Override

This commit is contained in:
Jakob Borg 2014-06-23 11:52:13 +02:00
parent e6f04ed238
commit db3e3ade80

View File

@ -858,8 +858,10 @@ func (m *Model) State(repo string) string {
func (m *Model) Override(repo string) { func (m *Model) Override(repo string) {
fs := m.NeedFilesRepo(repo) fs := m.NeedFilesRepo(repo)
m.rmut.Lock() m.rmut.RLock()
r := m.repoFiles[repo] r := m.repoFiles[repo]
m.rmut.RUnlock()
for i := range fs { for i := range fs {
f := &fs[i] f := &fs[i]
h := r.Get(cid.LocalID, f.Name) h := r.Get(cid.LocalID, f.Name)
@ -873,7 +875,6 @@ func (m *Model) Override(repo string) {
} }
f.Version = lamport.Default.Tick(f.Version) f.Version = lamport.Default.Tick(f.Version)
} }
m.rmut.Unlock()
r.Update(cid.LocalID, fs) r.Update(cid.LocalID, fs)
} }