Merge pull request #5968 from filcloud/ping-ask
remove duplicate ask and calculate ping before lock
This commit is contained in:
commit
462a44902e
@ -1297,6 +1297,7 @@ var clientListAsksCmd = &cli.Command{
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "by-ping",
|
||||
Usage: "sort by ping",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "output-format",
|
||||
@ -1451,17 +1452,17 @@ loop:
|
||||
}
|
||||
|
||||
rt := time.Now()
|
||||
|
||||
_, err = api.ClientQueryAsk(ctx, *mi.PeerId, miner)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
pingDuration := time.Now().Sub(rt)
|
||||
|
||||
atomic.AddInt64(&got, 1)
|
||||
lk.Lock()
|
||||
asks = append(asks, QueriedAsk{
|
||||
Ask: ask,
|
||||
Ping: time.Now().Sub(rt),
|
||||
Ping: pingDuration,
|
||||
})
|
||||
lk.Unlock()
|
||||
}(miner)
|
||||
|
Loading…
Reference in New Issue
Block a user