1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2026-04-07 02:01:12 +00:00

Fix for websocket queries which don't expects response getting stuck in subscribing state

This commit is contained in:
Jkorf 2026-02-17 14:35:02 +01:00
parent 297eee0e1f
commit 419e01d009
2 changed files with 6 additions and 2 deletions

View File

@ -170,6 +170,6 @@ namespace CryptoExchange.Net.Objects.Sockets
}
/// <inheritdoc />
public override string ToString() => base.ToString().TrimEnd('-') + Data?.ToString();
public override string ToString() => base.ToString().TrimEnd(' ', '-') + " - " + Data?.ToString();
}
}

View File

@ -1137,7 +1137,7 @@ namespace CryptoExchange.Net.Sockets.Default
return CallResult.SuccessResult;
}
subQuery.OnComplete = () =>
var subCompleteHandler = () =>
{
subscription.Status = subQuery.Result!.Success ? SubscriptionStatus.Subscribed : SubscriptionStatus.Pending;
subscription.HandleSubQueryResponse(this, subQuery.Response);
@ -1150,6 +1150,7 @@ namespace CryptoExchange.Net.Sockets.Default
}, false);
}
};
subQuery.OnComplete = subCompleteHandler;
var subQueryResult = await SendAndWaitQueryAsync(subQuery).ConfigureAwait(false);
if (!subQueryResult)
@ -1161,6 +1162,9 @@ namespace CryptoExchange.Net.Sockets.Default
return new CallResult<UpdateSubscription>(subQueryResult.Error!);
}
if (!subQuery.ExpectsResponse)
subCompleteHandler();
return subQueryResult;
}