Skip to content

Instantly share code, notes, and snippets.

@dmora
Last active July 18, 2018 16:38
Show Gist options
  • Save dmora/0841dbc8cf37f6176d9fc3e6f99f63da to your computer and use it in GitHub Desktop.
Save dmora/0841dbc8cf37f6176d9fc3e6f99f63da 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 *Manager) allocate(jobs []interface{}) {
defer close(m.jobs)
for i, v := range jobs {
job := Job{id: i, resource: v}
m.jobs <- job
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment