fix: settle canceled market data requests
This commit is contained in:
@@ -287,6 +287,7 @@ public sealed partial class MainWindow : Window
|
|||||||
|
|
||||||
await _databaseActivityGate.WaitAsync(requestCancellation.Token);
|
await _databaseActivityGate.WaitAsync(requestCancellation.Token);
|
||||||
databaseActivityEntered = true;
|
databaseActivityEntered = true;
|
||||||
|
requestCancellation.Token.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
// Close the race where playout starts after this request is published
|
// Close the race where playout starts after this request is published
|
||||||
// but before its market query begins.
|
// but before its market query begins.
|
||||||
@@ -317,7 +318,26 @@ public sealed partial class MainWindow : Window
|
|||||||
}
|
}
|
||||||
catch (OperationCanceledException) when (requestCancellation.IsCancellationRequested)
|
catch (OperationCanceledException) when (requestCancellation.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
// A newer navigation request or app shutdown superseded this response.
|
PostPlayoutPriorityMarketDataCancellationIfCurrent(
|
||||||
|
requestId,
|
||||||
|
view,
|
||||||
|
requestCancellation);
|
||||||
|
}
|
||||||
|
catch (DatabaseOperationException) when (requestCancellation.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
// Some providers surface a provider exception instead of cancellation after
|
||||||
|
// a command has already taken priority. Never publish that stale failure.
|
||||||
|
PostPlayoutPriorityMarketDataCancellationIfCurrent(
|
||||||
|
requestId,
|
||||||
|
view,
|
||||||
|
requestCancellation);
|
||||||
|
}
|
||||||
|
catch (Exception) when (requestCancellation.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
PostPlayoutPriorityMarketDataCancellationIfCurrent(
|
||||||
|
requestId,
|
||||||
|
view,
|
||||||
|
requestCancellation);
|
||||||
}
|
}
|
||||||
catch (DatabaseOperationException exception)
|
catch (DatabaseOperationException exception)
|
||||||
{
|
{
|
||||||
@@ -346,6 +366,26 @@ public sealed partial class MainWindow : Window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PostPlayoutPriorityMarketDataCancellationIfCurrent(
|
||||||
|
string requestId,
|
||||||
|
MarketDataView view,
|
||||||
|
CancellationTokenSource requestCancellation)
|
||||||
|
{
|
||||||
|
if (_lifetimeCancellation.IsCancellationRequested ||
|
||||||
|
!ReferenceEquals(
|
||||||
|
Volatile.Read(ref _marketDataCancellation),
|
||||||
|
requestCancellation))
|
||||||
|
{
|
||||||
|
// App shutdown or a newer navigation request superseded this response.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PostMarketDataError(
|
||||||
|
requestId,
|
||||||
|
view,
|
||||||
|
"송출 명령과 자동 갱신을 우선 처리하기 위해 조회를 취소했습니다. 다시 조회하세요.");
|
||||||
|
}
|
||||||
|
|
||||||
private void PostMarketDataError(string requestId, MarketDataView view, string message)
|
private void PostMarketDataError(string requestId, MarketDataView view, string message)
|
||||||
{
|
{
|
||||||
PostMessage("market-data-error", new
|
PostMessage("market-data-error", new
|
||||||
|
|||||||
Reference in New Issue
Block a user