Skip to content

Commit

Permalink
Revert "Added downloader request count (#10036)"
Browse files Browse the repository at this point in the history
This reverts commit 9af7278.
  • Loading branch information
AskAlexSharov authored Apr 25, 2024
1 parent 9976e3c commit 850ba5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 6 additions & 4 deletions erigon-lib/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ type downloadProgress struct {
}

type AggStats struct {
Requested int
MetadataReady, FilesTotal int32
LastMetadataUpdate *time.Time
PeersUnique int32
Expand Down Expand Up @@ -1828,7 +1827,7 @@ func (d *Downloader) ReCalcStats(interval time.Duration) {

prevStats, stats := d.stats, d.stats

stats.Completed = len(torrents) == stats.Requested
stats.Completed = true
stats.BytesDownload = uint64(connStats.BytesReadUsefulIntendedData.Int64())
stats.BytesUpload = uint64(connStats.BytesWrittenData.Int64())

Expand Down Expand Up @@ -1928,8 +1927,11 @@ func (d *Downloader) ReCalcStats(interval time.Duration) {
}

// more detailed statistic: download rate of each peer (for each file)
if _, ok := downloading[torrentName]; ok {
downloading[torrentName] = progress
if !torrentComplete && progress != 0 {
if _, ok := downloading[torrentName]; ok {
downloading[torrentName] = progress
}

d.logger.Log(d.verbosity, "[snapshots] progress", "file", torrentName, "progress", fmt.Sprintf("%.2f%%", progress), "peers", len(peersOfThisFile), "webseeds", len(weebseedPeersOfThisFile))
d.logger.Log(d.verbosity, "[snapshots] webseed peers", webseedRates...)
d.logger.Log(d.verbosity, "[snapshots] bittorrent peers", rates...)
Expand Down
4 changes: 0 additions & 4 deletions erigon-lib/downloader/downloader_grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ func (s *GrpcServer) Add(ctx context.Context, request *proto_downloader.AddReque
logEvery := time.NewTicker(20 * time.Second)
defer logEvery.Stop()

s.d.lock.Lock()
s.d.stats.Requested += len(request.Items)
s.d.lock.Unlock()

for i, it := range request.Items {
if it.Path == "" {
return nil, fmt.Errorf("field 'path' is required")
Expand Down

0 comments on commit 850ba5a

Please sign in to comment.