From e032be0936d249da0d7cb0a2ce323cf327ee6323 Mon Sep 17 00:00:00 2001 From: Seednode Date: Mon, 1 Jan 2024 11:36:19 -0600 Subject: [PATCH] Set default concurrency from 1024->8192, replace chan int with chan struct{} for concurrency limits --- cmd/files.go | 6 +++--- cmd/root.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/files.go b/cmd/files.go index 55f69da..8717607 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -222,8 +222,8 @@ func hasSupportedFiles(path string, formats types.Types) (bool, error) { } } -func walkPath(path string, fileChannel chan<- string, stats *scanStatsChannels, limit chan int, formats types.Types) error { - limit <- 1 +func walkPath(path string, fileChannel chan<- string, stats *scanStatsChannels, limit chan struct{}, formats types.Types) error { + limit <- struct{}{} defer func() { <-limit @@ -400,7 +400,7 @@ func scanPaths(paths []string, sort string, index *fileIndex, formats types.Type } }() - limit := make(chan int, Concurrency) + limit := make(chan struct{}, Concurrency) var wg sync.WaitGroup diff --git a/cmd/root.go b/cmd/root.go index fa3ff33..b48771b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -14,7 +14,7 @@ import ( const ( AllowedCharacters string = `^[A-z0-9.\-_]+$` - ReleaseVersion string = "3.5.3" + ReleaseVersion string = "3.6.0" ) var ( @@ -115,7 +115,7 @@ func init() { rootCmd.Flags().BoolVar(&CaseSensitive, "case-sensitive", false, "use case-sensitive matching for filters") rootCmd.Flags().BoolVar(&Code, "code", false, "enable support for source code files") rootCmd.Flags().StringVar(&CodeTheme, "code-theme", "solarized-dark256", "theme for source code syntax highlighting") - rootCmd.Flags().IntVar(&Concurrency, "concurrency", 1024, "maximum concurrency for scan threads") + rootCmd.Flags().IntVar(&Concurrency, "concurrency", 8192, "maximum concurrency for scan threads") rootCmd.Flags().BoolVar(&DisableButtons, "disable-buttons", false, "disable first/prev/next/last buttons") rootCmd.Flags().BoolVar(&ExitOnError, "exit-on-error", false, "shut down webserver on error, instead of just printing the error") rootCmd.Flags().BoolVar(&Fallback, "fallback", false, "serve files as application/octet-stream if no matching format is registered")