From b133a1846c20c29cb1de3c3fe5b7def9fd15f284 Mon Sep 17 00:00:00 2001 From: viktorstrate Date: Fri, 25 Sep 2020 19:21:03 +0200 Subject: [PATCH] Fix bug with max worker jobs Fix bug where it was possible to set max scanner worker jobs to 0, resulting in the scanner not processing any jobs. --- api/graphql/resolvers/scanner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/graphql/resolvers/scanner.go b/api/graphql/resolvers/scanner.go index 1f16f6be..9d3eab0b 100644 --- a/api/graphql/resolvers/scanner.go +++ b/api/graphql/resolvers/scanner.go @@ -64,8 +64,8 @@ func (r *mutationResolver) SetPeriodicScanInterval(ctx context.Context, interval } func (r *mutationResolver) SetScannerConcurrentWorkers(ctx context.Context, workers int) (int, error) { - if workers < 0 { - return 0, errors.New("concurrent workers must be positive") + if workers < 1 { + return 0, errors.New("concurrent workers must at least be 1") } _, err := r.Database.Exec("UPDATE site_info SET concurrent_workers = ?", workers)