From c23666eabf3cf50b673abb5f74baa34c1365f41c Mon Sep 17 00:00:00 2001 From: Simon Ding Date: Mon, 31 Mar 2025 17:45:30 +0800 Subject: [PATCH] fix: task percent --- pkg/buildin/torrent.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/buildin/torrent.go b/pkg/buildin/torrent.go index 4018c71..20204a6 100644 --- a/pkg/buildin/torrent.go +++ b/pkg/buildin/torrent.go @@ -135,7 +135,11 @@ func (t *Torrent) Progress() (int, error) { if t.t.Complete().Bool() { return 100, nil } - return int(t.t.BytesCompleted() * 100 / t.TotalSize()), nil + p := int(t.t.BytesCompleted() * 100 / t.TotalSize()) + if p >= 100 { + p = 99 + } + return 99, nil } func (t *Torrent) Stop() error {