Skip to content

Commit

Permalink
Bugfix: Syncer & websocket circular dependency (thrasher-corp#743)
Browse files Browse the repository at this point in the history
* Fixes cyclical dependency

* why not lint

* Addresses potential wait if websocket subsystem is disabled
  • Loading branch information
gloriousCode authored Aug 11, 2021
1 parent c7c8cac commit 126187b
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 150 deletions.
4 changes: 2 additions & 2 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ func (bot *Engine) Start() error {
bot.currencyPairSyncer, err = setupSyncManager(
exchangeSyncCfg,
bot.ExchangeManager,
bot.websocketRoutineManager,
&bot.Config.RemoteControl)
&bot.Config.RemoteControl,
bot.Settings.EnableWebsocketRoutine)
if err != nil {
gctlog.Errorf(gctlog.Global, "Unable to initialise exchange currency pair syncer. Err: %s", err)
} else {
Expand Down
7 changes: 4 additions & 3 deletions engine/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ func (bot *Engine) SetSubsystem(subSystemName string, enable bool) error {
SyncTimeoutREST: bot.Settings.SyncTimeoutREST,
SyncTimeoutWebsocket: bot.Settings.SyncTimeoutWebsocket,
}
bot.currencyPairSyncer, err = setupSyncManager(exchangeSyncCfg,
bot.currencyPairSyncer, err = setupSyncManager(
exchangeSyncCfg,
bot.ExchangeManager,
bot.websocketRoutineManager,
&bot.Config.RemoteControl)
&bot.Config.RemoteControl,
bot.Settings.EnableWebsocketRoutine)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 126187b

Please sign in to comment.