2020-10-03 09:57:02 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
type worker interface {
|
|
|
|
Run(context.Context)
|
|
|
|
}
|
|
|
|
|
|
|
|
func startWorkers(c *cfg) {
|
|
|
|
for _, wrk := range c.workers {
|
|
|
|
c.wg.Add(1)
|
|
|
|
|
2020-10-08 13:11:34 +00:00
|
|
|
go func(w worker) {
|
|
|
|
w.Run(c.ctx)
|
2020-10-03 09:57:02 +00:00
|
|
|
c.wg.Done()
|
2020-10-08 13:11:34 +00:00
|
|
|
}(wrk)
|
2020-10-03 09:57:02 +00:00
|
|
|
}
|
|
|
|
}
|