Remove get torrents count config and use worker pool on all places
This commit is contained in:
@@ -27,7 +27,7 @@ func (t *TorrentManager) StartRepairJob() {
|
||||
t.repairTrigger = make(chan *Torrent)
|
||||
t.repairQueue = mapset.NewSet[*Torrent]()
|
||||
// there is 1 repair worker, with max 1 blocking task
|
||||
go func() {
|
||||
t.workerPool.Submit(func() {
|
||||
t.repairLog.Debug("Starting periodic repair job")
|
||||
repairTicker := time.NewTicker(time.Duration(t.Config.GetRepairEveryMins()) * time.Minute)
|
||||
defer repairTicker.Stop()
|
||||
@@ -44,7 +44,7 @@ func (t *TorrentManager) StartRepairJob() {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
func (t *TorrentManager) invokeRepair(torrent *Torrent) {
|
||||
@@ -106,7 +106,7 @@ func (t *TorrentManager) repairAll(torrent *Torrent) {
|
||||
var wg sync.WaitGroup
|
||||
haystack.IterCb(func(_ string, torrent *Torrent) {
|
||||
wg.Add(1)
|
||||
_ = t.workerPool.Submit(func() {
|
||||
t.workerPool.Submit(func() {
|
||||
defer wg.Done()
|
||||
if torrent.UnrepairableReason != "" {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user