Remove annoying logs

This commit is contained in:
Ben Sarmiento
2024-01-28 18:27:39 +01:00
parent 00e4f8013c
commit 0678af2bc2
6 changed files with 57 additions and 28 deletions

View File

@@ -50,17 +50,42 @@ func MainApp(configPath string) {
premium.MonitorPremiumStatus(rd, zurglog)
// extra 1 worker for the refresh job
workerPool, err := ants.NewPool(config.GetNumOfWorkers() + 1)
workerOptions := ants.Options{
Nonblocking: true,
PanicHandler: func(i interface{}) {},
Logger: log.Named("worker"),
}
workerPool, err := ants.NewPool(config.GetNumOfWorkers(), ants.WithOptions(workerOptions))
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))
if err != nil {
zurglog.Errorf("Failed to create worker pool: %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)
repairPool, err = ants.NewPool(1, ants.WithOptions(repairOptions))
if err != nil {
zurglog.Errorf("Failed to create repair pool: %v", err)
os.Exit(1)
@@ -69,7 +94,7 @@ func MainApp(configPath string) {
}
utils.EnsureDirExists("data") // Ensure the data directory exists
torrentMgr := torrent.NewTorrentManager(config, rd, workerPool, repairPool, log.Named("manager"))
torrentMgr := torrent.NewTorrentManager(config, rd, workerPool, refreshPool, repairPool, log.Named("manager"))
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetDownloadTimeoutSecs(), true, config, log.Named("dlclient"))
downloader := universal.NewDownloader(downloadClient)