mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
engine/syncer: Stop orderbook fallover to REST when websocket connection is active (#1361)
* sync manager: don't fall over to rest when websocket connection active * glorious: nits and fix bug --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -610,6 +610,12 @@ func (m *syncManager) syncOrderbook(c *currencyPairSyncAgent, e exchange.IBotExc
|
||||
e.SupportsREST() &&
|
||||
time.Since(s.LastUpdated) > m.config.TimeoutWebsocket &&
|
||||
time.Since(c.Created) > m.config.TimeoutWebsocket {
|
||||
if w, err := e.GetWebsocket(); err == nil && w.IsConnected() {
|
||||
// With an active websocket connection, we can assume the orderbook
|
||||
// is being updated via the websocket connection, It could be very
|
||||
// illiquid. There is no need to fall over to rest.
|
||||
return
|
||||
}
|
||||
// Downgrade to REST
|
||||
s.IsUsingWebsocket = false
|
||||
s.IsUsingREST = true
|
||||
|
||||
Reference in New Issue
Block a user