Merge pull request #3027 from yaohcn/change-lock

change to RLock
This commit is contained in:
Łukasz Magiera 2020-08-13 11:39:13 +02:00 committed by GitHub
commit f212ca60c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,8 @@ package sectorstorage
import "github.com/filecoin-project/sector-storage/storiface"
func (m *Manager) WorkerStats() map[uint64]storiface.WorkerStats {
m.sched.workersLk.Lock()
defer m.sched.workersLk.Unlock()
m.sched.workersLk.RLock()
defer m.sched.workersLk.RUnlock()
out := map[uint64]storiface.WorkerStats{}
@ -22,8 +22,8 @@ func (m *Manager) WorkerStats() map[uint64]storiface.WorkerStats {
}
func (m *Manager) WorkerJobs() map[uint64][]storiface.WorkerJob {
m.sched.workersLk.Lock()
defer m.sched.workersLk.Unlock()
m.sched.workersLk.RLock()
defer m.sched.workersLk.RUnlock()
out := map[uint64][]storiface.WorkerJob{}