Remove unused thread configuration from root command and streamline initialization process

- Eliminated the threads variable and its associated logic for setting maximum processing threads.
- Simplified the command initialization by removing unnecessary flags related to thread management.
This commit is contained in:
2025-09-02 05:59:18 -05:00
parent ee6fc32a1a
commit 7fb1fcf21f

View File

@@ -4,7 +4,6 @@ package cmd
import ( import (
"fmt" "fmt"
"os" "os"
"runtime"
"s1d3sw1ped/SteamCache2/config" "s1d3sw1ped/SteamCache2/config"
"s1d3sw1ped/SteamCache2/steamcache" "s1d3sw1ped/SteamCache2/steamcache"
"s1d3sw1ped/SteamCache2/steamcache/logger" "s1d3sw1ped/SteamCache2/steamcache/logger"
@@ -16,7 +15,6 @@ import (
) )
var ( var (
threads int
configPath string configPath string
logLevel string logLevel string
@@ -96,13 +94,6 @@ var rootCmd = &cobra.Command{
Str("config_path", configPath). Str("config_path", configPath).
Msg("Configuration loaded successfully") Msg("Configuration loaded successfully")
if runtime.GOMAXPROCS(-1) != threads {
runtime.GOMAXPROCS(threads)
logger.Logger.Info().
Int("threads", threads).
Msg("Maximum number of threads set")
}
sc := steamcache.New( sc := steamcache.New(
cfg.ListenAddress, cfg.ListenAddress,
cfg.Cache.Memory.Size, cfg.Cache.Memory.Size,
@@ -135,8 +126,6 @@ func Execute() {
func init() { func init() {
rootCmd.Flags().StringVarP(&configPath, "config", "c", "config.yaml", "Path to configuration file") rootCmd.Flags().StringVarP(&configPath, "config", "c", "config.yaml", "Path to configuration file")
rootCmd.Flags().IntVarP(&threads, "threads", "t", runtime.GOMAXPROCS(-1), "Number of worker threads to use for processing requests")
rootCmd.Flags().StringVarP(&logLevel, "log-level", "l", "info", "Logging level: debug, info, error") rootCmd.Flags().StringVarP(&logLevel, "log-level", "l", "info", "Logging level: debug, info, error")
rootCmd.Flags().StringVarP(&logFormat, "log-format", "f", "console", "Logging format: json, console") rootCmd.Flags().StringVarP(&logFormat, "log-format", "f", "console", "Logging format: json, console")
} }