1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 09:52:20 +08:00

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?
This commit is contained in:
Juan Batiz-Benet
2015-01-31 17:08:47 -08:00
parent 8bc223c09a
commit 1a2307aff6

View File

@ -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():