From 3597ab07f0c6cd0954e2c5fb5f85c96291a00f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fan=20Can=20Bak=C4=B1r?= Date: Wed, 1 Oct 2025 12:46:43 +0300 Subject: [PATCH] ai recommendations --- cmd/nuclei/main.go | 2 +- pkg/catalog/loader/loader.go | 6 +++++- pkg/types/types.go | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/nuclei/main.go b/cmd/nuclei/main.go index 2f6805a68..188d3fba9 100644 --- a/cmd/nuclei/main.go +++ b/cmd/nuclei/main.go @@ -411,7 +411,7 @@ on extensive configurability, massive extensibility and ease of use.`) flagSet.IntVarP(&options.JsConcurrency, "js-concurrency", "jsc", 120, "maximum number of javascript runtimes to be executed in parallel"), flagSet.IntVarP(&options.PayloadConcurrency, "payload-concurrency", "pc", 25, "max payload concurrency for each template"), flagSet.IntVarP(&options.ProbeConcurrency, "probe-concurrency", "prc", 50, "http probe concurrency with httpx"), - flagSet.IntVarP(&options.TemplateLoadingConcurrency, "template-loading-concurrency", "tlc", 50, "maximum number of concurrent template loading operations"), + flagSet.IntVarP(&options.TemplateLoadingConcurrency, "template-loading-concurrency", "tlc", types.DefaultTemplateLoadingConcurrency, "maximum number of concurrent template loading operations"), ) flagSet.CreateGroup("optimization", "Optimizations", flagSet.IntVar(&options.Timeout, "timeout", 10, "time to wait in seconds before timeout"), diff --git a/pkg/catalog/loader/loader.go b/pkg/catalog/loader/loader.go index 5e1d9919c..1a8fe5742 100644 --- a/pkg/catalog/loader/loader.go +++ b/pkg/catalog/loader/loader.go @@ -524,7 +524,11 @@ func (store *Store) LoadTemplatesWithTags(templatesList, tags []string) []*templ } } - wgLoadTemplates, errWg := syncutil.New(syncutil.WithSize(store.config.ExecutorOptions.Options.TemplateLoadingConcurrency)) + concurrency := store.config.ExecutorOptions.Options.TemplateLoadingConcurrency + if concurrency <= 0 { + concurrency = types.DefaultTemplateLoadingConcurrency + } + wgLoadTemplates, errWg := syncutil.New(syncutil.WithSize(concurrency)) if errWg != nil { panic("could not create wait group") } diff --git a/pkg/types/types.go b/pkg/types/types.go index 657e96975..08ed924ff 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -20,6 +20,8 @@ import ( unitutils "github.com/projectdiscovery/utils/unit" ) +const DefaultTemplateLoadingConcurrency = 50 + var ( // ErrNoMoreRequests is internal error to indicate that generator has no more requests to generate ErrNoMoreRequests = io.EOF @@ -785,7 +787,7 @@ func DefaultOptions() *Options { PayloadConcurrency: 25, HeadlessTemplateThreads: 10, ProbeConcurrency: 50, - TemplateLoadingConcurrency: 50, + TemplateLoadingConcurrency: DefaultTemplateLoadingConcurrency, Timeout: 5, Retries: 1, MaxHostError: 30,