Migrate remaining legacy operator workflows

This commit is contained in:
2026-07-12 05:39:27 +09:00
parent ffb8f43c19
commit a01836a2d7
132 changed files with 20566 additions and 720 deletions

View File

@@ -2,6 +2,7 @@ using System.Text.Json;
using MBN_STOCK_WEBVIEW.Core.Playout;
using MBN_STOCK_WEBVIEW.Core.Playout.Scenes;
using MBN_STOCK_WEBVIEW.Infrastructure;
using MBN_STOCK_WEBVIEW.Infrastructure.Diagnostics;
using MBN_STOCK_WEBVIEW.Playout;
using MBN_STOCK_WEBVIEW.Playout.Configuration;
@@ -18,7 +19,6 @@ public sealed partial class MainWindow
private LegacyPlayoutWorkflow? _playoutWorkflow;
private PlayoutOptions? _playoutOptions;
private MutableLegacySceneCueCompositionOptionsSource? _legacyCompositionOptionsSource;
private LegacySceneCueCompositionOptions? _lastEnabledLegacyComposition;
private string? _playoutInitializationError;
private int _playoutCommandInFlight;
private int _playoutShutdownStarted;
@@ -38,12 +38,9 @@ public sealed partial class MainWindow
_playoutOptions = options;
_legacyCompositionOptionsSource =
new MutableLegacySceneCueCompositionOptionsSource(compositionOptions);
_lastEnabledLegacyComposition = compositionOptions.BackgroundKind ==
LegacySceneBackgroundKind.None
? null
: compositionOptions;
_playoutEngine = PlayoutEngineFactory.Create(options);
_playoutEngine.StatusChanged += OnPlayoutStatusChanged;
ObserveNativeTornadoState(_playoutEngine.Status.State);
if (_databaseRuntime is not null)
{
_playoutWorkflow = LegacySceneRuntimeFactory.Create(
@@ -56,6 +53,7 @@ public sealed partial class MainWindow
}
catch (Exception exception)
{
ObserveNativeTornadoState(PlayoutConnectionState.Faulted);
_playoutInitializationError = exception is PlayoutConfigurationException
? exception.Message
: "Tornado 송출 어댑터를 초기화하지 못했습니다.";
@@ -89,6 +87,7 @@ public sealed partial class MainWindow
private void OnPlayoutStatusChanged(object? sender, PlayoutStatusChangedEventArgs args)
{
ObserveNativeTornadoState(args.Current.State);
_playoutWorkflow?.ObserveEngineStatus(args.Current);
if (string.IsNullOrWhiteSpace(args.Current.PreparedSceneName) &&
string.IsNullOrWhiteSpace(args.Current.OnAirSceneName))
@@ -186,9 +185,11 @@ public sealed partial class MainWindow
var databaseActivityEntered = false;
try
{
LogNativePlayoutCommandRequested(request.Command);
Interlocked.Exchange(ref _playoutCommandInFlight, 1);
if (IsBrowserCorrelationQuarantined())
{
LogNativePlayoutOutcomeUnknown(request.Command);
PostPlayoutCommandError(
request.RequestId,
request.Command,
@@ -202,6 +203,9 @@ public sealed partial class MainWindow
var refreshBeforeCommand = GetLegacyRefreshStatus();
if (refreshBeforeCommand.IsFaulted && request.Command != "take-out")
{
LogNativePlayoutCommandCompleted(
request.Command,
NativeOperatorPlayoutCompletion.Rejected);
PostPlayoutCommandError(
request.RequestId,
request.Command,
@@ -222,6 +226,9 @@ public sealed partial class MainWindow
// gates are released, leaving an emergency TAKE OUT actionable.
if (request.Command == "next" && engine.Status.IsPlayCompletionPending)
{
LogNativePlayoutCommandCompleted(
request.Command,
NativeOperatorPlayoutCompletion.Rejected);
PostPlayoutCommandError(
request.RequestId,
request.Command,
@@ -238,6 +245,7 @@ public sealed partial class MainWindow
databaseActivityEntered = true;
if (IsBrowserCorrelationQuarantined())
{
LogNativePlayoutOutcomeUnknown(request.Command);
PostPlayoutCommandError(
request.RequestId,
request.Command,
@@ -252,6 +260,7 @@ public sealed partial class MainWindow
workflow,
request,
_lifetimeCancellation.Token);
LogNativePlayoutCommandCompleted(request.Command, result.Code);
var status = engine.Status;
var workflowState = workflow.State;
@@ -312,6 +321,9 @@ public sealed partial class MainWindow
}
catch (OperationCanceledException)
{
LogNativePlayoutCommandCompleted(
request.Command,
NativeOperatorPlayoutCompletion.Cancelled);
PostPlayoutCommandError(
request.RequestId,
request.Command,
@@ -322,6 +334,9 @@ public sealed partial class MainWindow
}
catch (DatabaseOperationException exception)
{
LogNativePlayoutCommandCompleted(
request.Command,
NativeOperatorPlayoutCompletion.Unavailable);
PostPlayoutCommandError(
request.RequestId,
request.Command,
@@ -333,6 +348,9 @@ public sealed partial class MainWindow
catch (Exception exception) when (
exception is LegacySceneDataException or ArgumentException)
{
LogNativePlayoutCommandCompleted(
request.Command,
NativeOperatorPlayoutCompletion.Rejected);
PostPlayoutCommandError(
request.RequestId,
request.Command,
@@ -343,6 +361,7 @@ public sealed partial class MainWindow
}
catch
{
LogNativePlayoutOutcomeUnknown(request.Command);
PostPlayoutCommandError(
request.RequestId,
request.Command,
@@ -389,6 +408,7 @@ public sealed partial class MainWindow
// Latch before the first await so a reload or a second WebView message can
// never race ahead of native quarantine. The latch is process-lifetime only.
LogCurrentNativePlayoutOutcomeUnknown();
StopLegacyRefreshLoop();
QueuePlayoutStatus();