Remove options

This commit is contained in:
Ben Sarmiento
2024-01-29 02:59:01 +01:00
parent e69f57b930
commit cd5e0ef1a7
2 changed files with 6 additions and 24 deletions

View File

@@ -50,44 +50,26 @@ func MainApp(configPath string) {
premium.MonitorPremiumStatus(rd, zurglog)
workerOptions := ants.Options{
// Nonblocking: true,
PanicHandler: func(i interface{}) {},
Logger: log.Named("worker"),
}
workerPool, err := ants.NewPool(config.GetNumOfWorkers(), ants.WithOptions(workerOptions))
workerPool, err := ants.NewPool(config.GetNumOfWorkers())
if err != nil {
zurglog.Errorf("Failed to create worker pool: %v", err)
os.Exit(1)
}
defer workerPool.Release()
refreshOptions := ants.Options{
// Nonblocking: true,
PanicHandler: func(i interface{}) {},
Logger: log.Named("refreshworker"),
}
// extra 1 worker for the refresh job
refreshPool, err := ants.NewPool(1, ants.WithOptions(refreshOptions))
refreshPool, err := ants.NewPool(1)
if err != nil {
zurglog.Errorf("Failed to create worker pool: %v", err)
zurglog.Errorf("Failed to create refresh worker: %v", err)
os.Exit(1)
}
defer refreshPool.Release()
repairOptions := ants.Options{
// Nonblocking: true,
PanicHandler: func(i interface{}) {},
Logger: log.Named("repairworker"),
}
var repairPool *ants.Pool
if config.EnableRepair() {
repairPool, err = ants.NewPool(1, ants.WithOptions(repairOptions))
repairPool, err = ants.NewPool(1)
if err != nil {
zurglog.Errorf("Failed to create repair pool: %v", err)
zurglog.Errorf("Failed to create repair worker: %v", err)
os.Exit(1)
}
defer repairPool.Release()

View File

@@ -45,6 +45,7 @@ func (t *TorrentManager) refreshTorrents() []string {
}
wg.Wait()
close(infoChan)
t.log.Infof("Fetched info for %d torrents", len(instances))
// delete expired fixers
@@ -73,7 +74,6 @@ func (t *TorrentManager) refreshTorrents() []string {
}
t.log.Debugf("Delete once done left: %d", t.deleteOnceDone.Cardinality())
close(infoChan)
newlyFetchedKeys := mapset.NewSet[string]()
noInfoCount := 0
for info := range infoChan {