mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/network: try to stop stream.send.request spans on time
This commit is contained in:
parent
4533a2b76a
commit
e38bd0195b
1 changed files with 11 additions and 0 deletions
|
|
@ -18,12 +18,15 @@ package network
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/swarm/storage"
|
||||
"github.com/ethereum/go-ethereum/swarm/tracing"
|
||||
"github.com/opentracing/opentracing-go"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -318,6 +321,14 @@ func (f *Fetcher) doRequest(gone chan *enode.ID, peersToSkip *sync.Map, sources
|
|||
gone <- sourceID
|
||||
case <-f.ctx.Done():
|
||||
}
|
||||
|
||||
// finish the request span
|
||||
spanId := fmt.Sprintf("stream.send.request.%v.%v", *sourceID, req.Addr)
|
||||
span := tracing.ShiftSpanByKey(spanId)
|
||||
|
||||
if span != nil {
|
||||
defer span.(opentracing.Span).Finish()
|
||||
}
|
||||
}()
|
||||
return sources, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue