Only lock statuses map when status isn't successful

Determine the status successful or not first, that will reduce the chance
of lock contention.
This commit is contained in:
He Jie Xu 2020-08-18 22:40:15 +08:00
parent 9b78bd5979
commit dc52b69ddc

View File

@ -333,11 +333,11 @@ func (g *genericScheduler) findNodesThatPassFilters(ctx context.Context, prof *p
feasibleNodes[length-1] = nodeInfo.Node()
}
} else {
statusesLock.Lock()
if !status.IsSuccess() {
statusesLock.Lock()
statuses[nodeInfo.Node().Name] = status
statusesLock.Unlock()
}
statusesLock.Unlock()
}
}