Skip to content

Commit

Permalink
blockservice/worker: fix proc/limiter sync
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
jbenet committed Feb 1, 2015
1 parent 8bc223c commit 1a2307a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion blockservice/worker/worker.go
Expand Up @@ -120,7 +120,8 @@ func (w *Worker) start(c Config) {
// reads from |workerChan| until process closes
w.process.Go(func(proc process.Process) {
ctx := childContext(proc) // shut down in-progress HasBlock when time to die
limiter := ratelimit.NewRateLimiter(proc, c.NumWorkers)
limiter := ratelimit.NewRateLimiter(process.Background(), c.NumWorkers)
defer limiter.Close()
for {
select {
case <-proc.Closing():
Expand Down

0 comments on commit 1a2307a

Please sign in to comment.