Skip to content

Commit

Permalink
change default threadiness if logging enabled
Browse files Browse the repository at this point in the history
rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
gabemontero committed Feb 22, 2024
1 parent a9570cd commit 038781b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/watcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var (
disableCRDUpdate = flag.Bool("disable_crd_update", false, "Disables Tekton CRD annotation update on reconcile.")
authToken = flag.String("token", "", "Authentication token to use in requests. If not specified, on-cluster configuration is assumed.")
completedRunGracePeriod = flag.Duration("completed_run_grace_period", 0, "Grace period duration before Runs should be deleted. If 0, Runs will not be deleted. If < 0, Runs will be deleted immediately.")
threadiness = flag.Int("threadiness", controller.DefaultThreadsPerController, "Number of threads (Go routines) allocated to each controller")
threadiness = flag.Int("threadiness", controller.DefaultThreadsPerController, "Number of threads (Go routines) allocated to each controller. Default becomes 32 if sending logs is enabled")
logsAPI = flag.Bool("logs_api", true, "Disable sending logs. If not set, the logs will be sent only if server support API for it")
labelSelector = flag.String("label_selector", "", "Selector (label query) to filter objects to be deleted. Matching objects must satisfy all labels requirements to be eligible for deletion")
requeueInterval = flag.Duration("requeue_interval", 10*time.Minute, "How long the Watcher waits to reprocess keys on certain events (e.g. an object doesn't match the provided selectors)")
Expand All @@ -73,8 +73,13 @@ func main() {
flag.Parse()

// Allow users to customize the number of workers used to process the
// controller's workqueue.
controller.DefaultThreadsPerController = *threadiness
// controller's workqueue, but factor in used of logs api to move off of developer default
// unless the user has specifically set the thread count
if *logsAPI && *threadiness == controller.DefaultThreadsPerController {
controller.DefaultThreadsPerController = 32
} else {
controller.DefaultThreadsPerController = *threadiness
}

ctx := signals.NewContext()

Expand Down

0 comments on commit 038781b

Please sign in to comment.