task max of 0 should mean infinite
This commit is contained in:
parent
3b6e59378e
commit
daebec76bf
@ -19,7 +19,7 @@ var FOLLOW_FREQUENCY = 1 * time.Minute // Check for work to follow this often
|
||||
|
||||
type TaskTypeDetails struct {
|
||||
// Max returns how many tasks this machine can run of this type.
|
||||
// Negative means unrestricted.
|
||||
// Zero (default) or less means unrestricted.
|
||||
Max int
|
||||
|
||||
// Name is the task name to be added to the task list.
|
||||
|
@ -57,7 +57,9 @@ top:
|
||||
}
|
||||
|
||||
// 1. Can we do any more of this task type?
|
||||
if h.Max > -1 && int(h.Count.Load()) == h.Max {
|
||||
// NOTE: 0 is the default value, so this way people don't need to worry about
|
||||
// this setting unless they want to limit the number of tasks of this type.
|
||||
if h.Max > 0 && int(h.Count.Load()) >= h.Max {
|
||||
log.Debugw("did not accept task", "name", h.Name, "reason", "at max already")
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user