From 92e8063d39d1becba64e17171db5b6001a93b089 Mon Sep 17 00:00:00 2001 From: Oleg Shitikov Date: Mon, 13 May 2024 16:14:04 +0300 Subject: [PATCH] fix AddExpiredTime function (#392) --- server/torr/torrent.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/torr/torrent.go b/server/torr/torrent.go index 278db2f..733d64c 100644 --- a/server/torr/torrent.go +++ b/server/torr/torrent.go @@ -143,7 +143,10 @@ func (t *Torrent) GotInfo() bool { } func (t *Torrent) AddExpiredTime(duration time.Duration) { - t.expiredTime = time.Now().Add(duration) + newExpiredTime := time.Now().Add(duration) + if t.expiredTime.Before(newExpiredTime) { + t.expiredTime = newExpiredTime + } } func (t *Torrent) watch() {