engine: GetSubsystemsStatus fix (#773)

* engine: GetSubsystemsStatus fix

* engine: force map literal to stop doubling up on keys, expanded test coverage

* engine: Deploy default for migration requirement.

* glorious: nits addr

* glorious: suggestion

* tests: fix
This commit is contained in:
Ryan O'Hara-Reid
2021-09-03 11:59:52 +10:00
committed by GitHub
parent a1a667bab9
commit a54c5107f4
12 changed files with 251 additions and 72 deletions

View File

@@ -11,6 +11,9 @@ import (
"github.com/thrasher-corp/gocryptotrader/log"
)
// ErrNotRunning defines an error when the dispatcher is not running
var ErrNotRunning = errors.New("dispatcher not running")
// Name is an exported subsystem name
const Name = "dispatch"
@@ -117,7 +120,7 @@ func (d *Dispatcher) start(workers, channelCapacity int) error {
// stop stops the service and shuts down all worker routines
func (d *Dispatcher) stop() error {
if !atomic.CompareAndSwapUint32(&d.running, 1, 0) {
return errors.New("dispatcher not running")
return ErrNotRunning
}
close(d.shutdown)
ch := make(chan struct{})