Skip to content

Instantly share code, notes, and snippets.

@dmora
Created July 19, 2018 21:31
Show Gist options
  • Save dmora/777169bc99128a9c82b53797eeed22f3 to your computer and use it in GitHub Desktop.
Save dmora/777169bc99128a9c82b53797eeed22f3 to your computer and use it in GitHub Desktop.
// allocate allocates jobs based on an array of resources to be processed by the worker pool
func (m *Pool) allocate(jobs []interface{}) {
defer close(m.jobs)
log.DEBUG.Printf("Allocating [%d] resources", len(jobs))
for i, v := range jobs {
job := Job{id: i, resource: v}
m.jobs <- job
}
log.DEBUG.Print("Done Allocating.")
}
@dominikbraun
Copy link

Shouldn't the parameter jobs rather be named resources to avoid confusion with m.jobs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment