@icgio/icg-exchanges-wrapper 1.17.24 → 1.17.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -308,19 +308,9 @@ const get_exchanges_rates = function (Exchanges, exchange_pair_dict, cb, ws_enab
|
|
|
308
308
|
|
|
309
309
|
check_status()
|
|
310
310
|
})
|
|
311
|
-
//
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
setTimeout(() => {
|
|
315
|
-
if (ws_connection_promises[ws_key] === ws_promise) {
|
|
316
|
-
delete ws_connection_promises[ws_key]
|
|
317
|
-
// Also clean up wrapped promise if it exists
|
|
318
|
-
if (ws_connection_promises_with_fallback[ws_key]) {
|
|
319
|
-
delete ws_connection_promises_with_fallback[ws_key]
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}, 1000)
|
|
323
|
-
})
|
|
311
|
+
// Keep the cached promise as long as the underlying socket is alive.
|
|
312
|
+
// The next tick's `is_opening_or_opened` check reads `Exchange.ws.market.status`;
|
|
313
|
+
// when that flips to 'closed'/'stopped' the else-branch below overwrites this slot.
|
|
324
314
|
}
|
|
325
315
|
|
|
326
316
|
// Wrap WebSocket promise to handle rejection and fall back to REST
|
|
@@ -589,18 +579,9 @@ const get_exchanges_market_history = function (Exchanges, exchange_pair_dict, ti
|
|
|
589
579
|
}
|
|
590
580
|
check_status()
|
|
591
581
|
})
|
|
592
|
-
//
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
if (ws_market_history_promises[ws_key] === ws_promise) {
|
|
596
|
-
delete ws_market_history_promises[ws_key]
|
|
597
|
-
// Also clean up wrapped promise if it exists
|
|
598
|
-
if (ws_market_history_promises_with_fallback[ws_key]) {
|
|
599
|
-
delete ws_market_history_promises_with_fallback[ws_key]
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
}, 1000)
|
|
603
|
-
})
|
|
582
|
+
// Keep the cached promise as long as the underlying socket is alive.
|
|
583
|
+
// The next tick's `is_opening_or_opened` check reads `Exchange.ws.market.status`;
|
|
584
|
+
// when that flips to 'closed'/'stopped' the else-branch below overwrites this slot.
|
|
604
585
|
}
|
|
605
586
|
|
|
606
587
|
// If WebSocket promise rejects (timeout/error), fall back to REST for all pairs
|