mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 23:16:53 +00:00
(Engine) Bugfix: Unlocking an unlocked mutex PANIC + Increase dispatcher job capacity via commandline (#371)
* Removes lock unlock timer and instead sets unlocks between getting a nonce and sending a payload. Increases dispatch channel buffer to deal with len(enabledCurrencies) > ~100 * Adds additional comments to help explain the situation * Fixes bug that could unlock mutex too early * Fixes LIES where Gemini gets a nonce and then proceeds to declare it doesn't get a nonce causing an unrecoverable lock * Fun new concept! The creation of a tested timed mutex. Unlocking an unlocked mutex cannot occur and response can be checked to verify whether the mutex was unlocked from timeout or command. * Adds new cmd parameter "dispatchjobbuffer" * Expands comments and renames benchmark. Makes `Timer` property private * Happy little linters * Renames jobBuffer and all related instances to jobs limit * Tiny error message update * Grammatical fix and setting dispatch.Start to use defaults
This commit is contained in:
@@ -207,6 +207,7 @@ func ValidateSettings(b *Engine, s *Settings) {
|
||||
|
||||
b.Settings.GlobalHTTPProxy = s.GlobalHTTPProxy
|
||||
b.Settings.DispatchMaxWorkerAmount = s.DispatchMaxWorkerAmount
|
||||
b.Settings.DispatchJobsLimit = s.DispatchJobsLimit
|
||||
}
|
||||
|
||||
// PrintSettings returns the engine settings
|
||||
@@ -237,6 +238,7 @@ func PrintSettings(s *Settings) {
|
||||
log.Debugf(log.Global, "\t Enable Database manager: %v", s.EnableDatabaseManager)
|
||||
log.Debugf(log.Global, "\t Enable dispatcher: %v", s.EnableDispatcher)
|
||||
log.Debugf(log.Global, "\t Dispatch package max worker amount: %d", s.DispatchMaxWorkerAmount)
|
||||
log.Debugf(log.Global, "\t Dispatch package jobs limit: %d", s.DispatchJobsLimit)
|
||||
log.Debugf(log.Global, "- FOREX SETTINGS:")
|
||||
log.Debugf(log.Global, "\t Enable currency conveter: %v", s.EnableCurrencyConverter)
|
||||
log.Debugf(log.Global, "\t Enable currency layer: %v", s.EnableCurrencyLayer)
|
||||
@@ -274,7 +276,7 @@ func (e *Engine) Start() error {
|
||||
}
|
||||
|
||||
if e.Settings.EnableDispatcher {
|
||||
if err := dispatch.Start(e.Settings.DispatchMaxWorkerAmount); err != nil {
|
||||
if err := dispatch.Start(e.Settings.DispatchMaxWorkerAmount, e.Settings.DispatchJobsLimit); err != nil {
|
||||
log.Errorf(log.DispatchMgr, "Dispatcher unable to start: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +65,5 @@ type Settings struct {
|
||||
// Dispatch system settings
|
||||
EnableDispatcher bool
|
||||
DispatchMaxWorkerAmount int
|
||||
DispatchJobsLimit int
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ func SetSubsystem(subsys string, enable bool) error {
|
||||
Bot.ExchangeCurrencyPairManager.Stop()
|
||||
case "dispatch":
|
||||
if enable {
|
||||
return dispatch.Start(Bot.Settings.DispatchMaxWorkerAmount)
|
||||
return dispatch.Start(Bot.Settings.DispatchMaxWorkerAmount, Bot.Settings.DispatchJobsLimit)
|
||||
}
|
||||
return dispatch.Stop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user