Merge pull request #2736 from cfromknecht/config-num-workers

lncfg: add CLI worker configuration
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2019-03-19 15:47:38 -07:00
commit 71161848aa
4 files changed
+167 -4

No files matched your search

+13
View File
@@ -252,6 +252,8 @@ type config struct {
net tor.Net
Routing *routing.Conf `group:"routing" namespace:"routing"`
Workers *lncfg.Workers `group:"workers" namespace:"workers"`
}
// loadConfig initializes and parses the config using a config file and command
@@ -334,6 +336,11 @@ func loadConfig() (*config, error) {
Control: defaultTorControl,
},
net: &tor.ClearNet{},
Workers: &lncfg.Workers{
Read: lncfg.DefaultReadWorkers,
Write: lncfg.DefaultWriteWorkers,
Sig: lncfg.DefaultSigWorkers,
},
}
// Pre-parse the command line options to pick up an alternative config
@@ -968,6 +975,12 @@ func loadConfig() (*config, error) {
"minbackoff")
}
// Assert that all worker pools will have a positive number of
// workers, otherwise the pools will rendered useless.
if err := cfg.Workers.Validate(); err != nil {
return nil, err
}
// Finally, ensure that the user's color is correctly formatted,
// otherwise the server will not be able to start after the unlocking
// the wallet.