INNER CODE UNIT · Go
func
ovh/utask · utask.go:219
func (c *Cfg) buildLimits() {
c.resourceSemaphores = make(map[string]*semaphore.Weighted)
c.deadResources = make(map[string]struct{})
for k, v := range c.ResourceLimits {
if v <= 0 {
c.deadResources[k] = struct{}{}
} else {
c.resourceSemaphores[k] = semaphore.NewWeighted(int64(v))
}
}
if maxConcurrentExecutions := c.getMaxConcurrentExecutions(); maxConcurrentExecutions >= 0 {
c.executionSemaphore = semaphore.NewWeighted(int64(maxConcurrentExecutions))
}
}
func (c *Cfg) getMaxConcurrentExecutions() int {