@cryptotaxi247 / kubo / commits / 1a2307aff

blockservice/worker: fix proc/limiter sync

see: https://gist.github.com/jbenet/6b8b45bde9d9fce17d57 I want to make the goprocess API nicer so it doesnt lead users into this problem. any ideas?

Juan Batiz-Benet committed Jan 31, 2015 at 17:08 UTC 1a2307aff638a344983536a04f7d2bf29b2afc92
1 file changed +2 -1
blockservice/worker/worker.go
+2 -1
@@ -120,7 +120,8 @@ func (w *Worker) start(c Config) {
120 // reads from |workerChan| until process closes
121 w.process.Go(func(proc process.Process) {
122 ctx := childContext(proc) // shut down in-progress HasBlock when time to die
123 - limiter := ratelimit.NewRateLimiter(proc, c.NumWorkers)
123 + limiter := ratelimit.NewRateLimiter(process.Background(), c.NumWorkers)
124 + defer limiter.Close()
125 for {
126 select {
127 case <-proc.Closing():