(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:
Scott
2019-10-29 14:00:45 +11:00
committed by Adrian Gallagher
parent 1805c40f20
commit 242b02c382
16 changed files with 301 additions and 139 deletions

View File

@@ -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)
}
}