fsjobqueue: extract channelSize constant
This commit is contained in:
parent
3bcce32c9b
commit
e007f9964e
1 changed files with 5 additions and 1 deletions
|
|
@ -59,6 +59,10 @@ type job struct {
|
||||||
Canceled bool `json:"canceled,omitempty"`
|
Canceled bool `json:"canceled,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The size of channels used in fsJobQueue for queueing jobs.
|
||||||
|
// Note that each job type has its own queue.
|
||||||
|
const channelSize = 100
|
||||||
|
|
||||||
// Create a new fsJobQueue object for `dir`. This object must have exclusive
|
// Create a new fsJobQueue object for `dir`. This object must have exclusive
|
||||||
// access to `dir`. If `dir` contains jobs created from previous runs, they are
|
// access to `dir`. If `dir` contains jobs created from previous runs, they are
|
||||||
// loaded and rescheduled to run if necessary.
|
// loaded and rescheduled to run if necessary.
|
||||||
|
|
@ -70,7 +74,7 @@ func New(dir string, acceptedJobTypes []string) (*fsJobQueue, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, jt := range acceptedJobTypes {
|
for _, jt := range acceptedJobTypes {
|
||||||
q.pending[jt] = make(chan uuid.UUID, 100)
|
q.pending[jt] = make(chan uuid.UUID, channelSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for jobs that are still pending and build the dependant map.
|
// Look for jobs that are still pending and build the dependant map.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue