Skip to content

Commit 5e03cb5

Browse files
committed
Fixed SymbolOrderBook websocket subscription not getting closed if when waiting for initial data times out
1 parent c5b953e commit 5e03cb5

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

Binance.Net/SymbolOrderBooks/BinanceFuturesCoinSymbolOrderBook.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ protected override async Task<CallResult<UpdateSubscription>> DoStartAsync(Cance
103103
else
104104
{
105105
var setResult = await WaitForSetOrderBookAsync(_initialDataTimeout, ct).ConfigureAwait(false);
106+
if (!setResult)
107+
await subResult.Data.CloseAsync().ConfigureAwait(false);
108+
106109
return setResult ? subResult : new CallResult<UpdateSubscription>(setResult.Error!);
107110
}
108111

Binance.Net/SymbolOrderBooks/BinanceFuturesUsdtSymbolOrderBook.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ protected override async Task<CallResult<UpdateSubscription>> DoStartAsync(Cance
103103
else
104104
{
105105
var setResult = await WaitForSetOrderBookAsync(_initialDataTimeout, ct).ConfigureAwait(false);
106+
if (!setResult)
107+
await subResult.Data.CloseAsync().ConfigureAwait(false);
108+
106109
return setResult ? subResult : new CallResult<UpdateSubscription>(setResult.Error!);
107110
}
108111

Binance.Net/SymbolOrderBooks/BinanceSpotSymbolOrderBook.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ protected override async Task<CallResult<UpdateSubscription>> DoStartAsync(Cance
9999
else
100100
{
101101
var setResult = await WaitForSetOrderBookAsync(_initialDataTimeout, ct).ConfigureAwait(false);
102+
if (!setResult)
103+
await subResult.Data.CloseAsync().ConfigureAwait(false);
104+
102105
return setResult ? subResult : new CallResult<UpdateSubscription>(setResult.Error!);
103106
}
104107

0 commit comments

Comments
 (0)