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:
@ -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():
|
||||
|
Reference in New Issue
Block a user