Makes the number of worker threads configurable.

This commit is contained in:
Christian Huffman
2020-03-30 16:13:11 -04:00
parent 505542bc75
commit 12f4e1c114
2 changed files with 4 additions and 10 deletions

View File

@@ -48,9 +48,6 @@ import (
)
const (
// Number of worker threads
threads = 10
// Default timeout of short CSI calls like GetPluginInfo
defaultCSITimeout = time.Minute
)
@@ -63,6 +60,7 @@ var (
snapshotNamePrefix = flag.String("snapshot-name-prefix", "snapshot", "Prefix to apply to the name of a created snapshot")
snapshotNameUUIDLength = flag.Int("snapshot-name-uuid-length", -1, "Length in characters for the generated uuid of a created snapshot. Defaults behavior is to NOT truncate.")
showVersion = flag.Bool("version", false, "Show version.")
threads = flag.Int("worker-threads", 10, "Number of worker threads.")
csiTimeout = flag.Duration("timeout", defaultCSITimeout, "The timeout for any RPCs to the CSI driver. Default is 1 minute.")
leaderElection = flag.Bool("leader-election", false, "Enables leader election.")
@@ -182,7 +180,7 @@ func main() {
stopCh := make(chan struct{})
factory.Start(stopCh)
coreFactory.Start(stopCh)
go ctrl.Run(threads, stopCh)
go ctrl.Run(*threads, stopCh)
// ...until SIGINT
c := make(chan os.Signal, 1)