Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobMap ¶
type JobMap struct {
// contains filtered or unexported fields
}
JobMap associates function invocations ("jobs") with keys (interface{}), where no two jobs with the same key may run at the same time, and only the latest known job for a given key may be pending to run.
func (*JobMap) Run ¶
Run starts jobs queued with TakeJob() on their own go-routines. If no job for a given key is running, the next job with that key will run immediately. If a job for a given key is running, a following job with that key will be pending to run after the running job finishes. If a job for a given key is pending to run, a following job with the same key will take its place. When ctx is cancelled, Run will wait for running jobs to finish and return.