提交 1a2307af 作者: Juan Batiz-Benet

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?
上级 8bc223c0
......@@ -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():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论