Created
July 19, 2018 21:31
-
-
Save dmora/777169bc99128a9c82b53797eeed22f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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.") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shouldn't the parameter
jobs
rather be namedresources
to avoid confusion withm.jobs
?