mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
added grabbing info about downloaded metadata (#8972)
This commit is contained in:
parent
06e77d1705
commit
ac1e42b68d
@ -53,6 +53,7 @@ func (d *DiagnosticClient) runSnapshotListener() {
|
|||||||
d.snapshotDownload.Alloc = info.Alloc
|
d.snapshotDownload.Alloc = info.Alloc
|
||||||
d.snapshotDownload.Sys = info.Sys
|
d.snapshotDownload.Sys = info.Sys
|
||||||
d.snapshotDownload.DownloadFinished = info.DownloadFinished
|
d.snapshotDownload.DownloadFinished = info.DownloadFinished
|
||||||
|
d.snapshotDownload.TorrentMetadataReady = info.TorrentMetadataReady
|
||||||
|
|
||||||
if info.DownloadFinished {
|
if info.DownloadFinished {
|
||||||
return
|
return
|
||||||
|
@ -30,18 +30,19 @@ type PeerStatistics struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SnapshotDownloadStatistics struct {
|
type SnapshotDownloadStatistics struct {
|
||||||
Downloaded uint64 `json:"downloaded"`
|
Downloaded uint64 `json:"downloaded"`
|
||||||
Total uint64 `json:"total"`
|
Total uint64 `json:"total"`
|
||||||
TotalTime float64 `json:"totalTime"`
|
TotalTime float64 `json:"totalTime"`
|
||||||
DownloadRate uint64 `json:"downloadRate"`
|
DownloadRate uint64 `json:"downloadRate"`
|
||||||
UploadRate uint64 `json:"uploadRate"`
|
UploadRate uint64 `json:"uploadRate"`
|
||||||
Peers int32 `json:"peers"`
|
Peers int32 `json:"peers"`
|
||||||
Files int32 `json:"files"`
|
Files int32 `json:"files"`
|
||||||
Connections uint64 `json:"connections"`
|
Connections uint64 `json:"connections"`
|
||||||
Alloc uint64 `json:"alloc"`
|
Alloc uint64 `json:"alloc"`
|
||||||
Sys uint64 `json:"sys"`
|
Sys uint64 `json:"sys"`
|
||||||
DownloadFinished bool `json:"downloadFinished"`
|
DownloadFinished bool `json:"downloadFinished"`
|
||||||
Segments map[string]SegmentDownloadStatistics `json:"segments"`
|
Segments map[string]SegmentDownloadStatistics `json:"segments"`
|
||||||
|
TorrentMetadataReady int32 `json:"torrentMetadataReady"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SegmentDownloadStatistics struct {
|
type SegmentDownloadStatistics struct {
|
||||||
|
@ -160,10 +160,26 @@ Loop:
|
|||||||
log.Info(fmt.Sprintf("[%s] download finished", logPrefix), "time", time.Since(downloadStartTime).String())
|
log.Info(fmt.Sprintf("[%s] download finished", logPrefix), "time", time.Since(downloadStartTime).String())
|
||||||
break Loop
|
break Loop
|
||||||
} else {
|
} else {
|
||||||
|
diagnostics.Send(diagnostics.SnapshotDownloadStatistics{
|
||||||
|
Downloaded: stats.BytesCompleted,
|
||||||
|
Total: stats.BytesTotal,
|
||||||
|
TotalTime: time.Since(downloadStartTime).Round(time.Second).Seconds(),
|
||||||
|
DownloadRate: stats.DownloadRate,
|
||||||
|
UploadRate: stats.UploadRate,
|
||||||
|
Peers: stats.PeersUnique,
|
||||||
|
Files: stats.FilesTotal,
|
||||||
|
Connections: stats.ConnectionsTotal,
|
||||||
|
Alloc: m.Alloc,
|
||||||
|
Sys: m.Sys,
|
||||||
|
DownloadFinished: stats.Completed,
|
||||||
|
TorrentMetadataReady: stats.MetadataReady,
|
||||||
|
})
|
||||||
|
|
||||||
if stats.MetadataReady < stats.FilesTotal {
|
if stats.MetadataReady < stats.FilesTotal {
|
||||||
log.Info(fmt.Sprintf("[%s] Waiting for torrents metadata: %d/%d", logPrefix, stats.MetadataReady, stats.FilesTotal))
|
log.Info(fmt.Sprintf("[%s] Waiting for torrents metadata: %d/%d", logPrefix, stats.MetadataReady, stats.FilesTotal))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg.ReadMemStats(&m)
|
dbg.ReadMemStats(&m)
|
||||||
downloadTimeLeft := calculateTime(stats.BytesTotal-stats.BytesCompleted, stats.DownloadRate)
|
downloadTimeLeft := calculateTime(stats.BytesTotal-stats.BytesCompleted, stats.DownloadRate)
|
||||||
suffix := "downloading"
|
suffix := "downloading"
|
||||||
@ -171,20 +187,6 @@ Loop:
|
|||||||
suffix += " (or verifying)"
|
suffix += " (or verifying)"
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnostics.Send(diagnostics.SnapshotDownloadStatistics{
|
|
||||||
Downloaded: stats.BytesCompleted,
|
|
||||||
Total: stats.BytesTotal,
|
|
||||||
TotalTime: time.Since(downloadStartTime).Round(time.Second).Seconds(),
|
|
||||||
DownloadRate: stats.DownloadRate,
|
|
||||||
UploadRate: stats.UploadRate,
|
|
||||||
Peers: stats.PeersUnique,
|
|
||||||
Files: stats.FilesTotal,
|
|
||||||
Connections: stats.ConnectionsTotal,
|
|
||||||
Alloc: m.Alloc,
|
|
||||||
Sys: m.Sys,
|
|
||||||
DownloadFinished: stats.Completed,
|
|
||||||
})
|
|
||||||
|
|
||||||
log.Info(fmt.Sprintf("[%s] %s", logPrefix, suffix),
|
log.Info(fmt.Sprintf("[%s] %s", logPrefix, suffix),
|
||||||
"progress", fmt.Sprintf("%.2f%% %s/%s", stats.Progress, common.ByteCount(stats.BytesCompleted), common.ByteCount(stats.BytesTotal)),
|
"progress", fmt.Sprintf("%.2f%% %s/%s", stats.Progress, common.ByteCount(stats.BytesCompleted), common.ByteCount(stats.BytesTotal)),
|
||||||
"time-left", downloadTimeLeft,
|
"time-left", downloadTimeLeft,
|
||||||
|
Loading…
Reference in New Issue
Block a user