-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Is your feature request related to a problem? Please describe.
Since this is right now declared as an interface with a single Run() method I am unable to pass any other variables as part of context.
Describe the solution you'd like
Using anonymous function instead of interface we don't need to declare any new types and are able to use execution context. Such as (from the example code):
func main() {
// init some external client
c := client.New(...)
max := 10
inputChan := make(chan concurrently.WorkFunction)
output := concurrently.Process(inputChan, &concurrently.Options{PoolSize: 10, OutChannelBuffer: 10})
go func() {
for work := 0; work < max; work++ {
inputChan <- func() interface{} {
// do some work using client
result := c.DoWork(work)
return result
}
}
close(inputChan)
}()
for out := range output {
log.Println(out.Value)
}
}Describe alternatives you've considered
N/A
Additional context
N/A
Metadata
Metadata
Assignees
Labels
No labels