fix(game): 清理切换管道中的低风险 MA0004

- 修复 Scene 与 UI 过渡管道中间件链的多余 async 包装

- 更新低风险 await 调用以显式使用 ConfigureAwait(false)
This commit is contained in:
gewuyou 2026-04-25 09:20:00 +08:00
parent 1dae0b11a0
commit 27f5a2f58e
2 changed files with 13 additions and 13 deletions

View File

@ -148,7 +148,7 @@ public class SceneTransitionPipeline
foreach (var handler in sortedHandlers)
{
var options = _options[handler];
await ExecuteSingleHandlerAsync(handler, options, @event, cancellationToken);
await ExecuteSingleHandlerAsync(handler, options, @event, cancellationToken).ConfigureAwait(false);
}
Log.Debug("Pipeline execution completed for phases: {0}", phases);
@ -173,7 +173,7 @@ public class SceneTransitionPipeline
if (handlers.Count == 0)
{
await coreAction();
await coreAction().ConfigureAwait(false);
return;
}
@ -191,11 +191,11 @@ public class SceneTransitionPipeline
var options = _aroundOptions[handler];
var next = pipeline;
pipeline = async () => await ExecuteSingleAroundHandlerAsync(
handler, options, @event, next, cancellationToken);
pipeline = () => ExecuteSingleAroundHandlerAsync(
handler, options, @event, next, cancellationToken);
}
await pipeline();
await pipeline().ConfigureAwait(false);
}
private List<ISceneTransitionHandler> FilterAndSortHandlers(
@ -283,7 +283,7 @@ public class SceneTransitionPipeline
? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token)
: null;
await handler.HandleAsync(@event, next, linkedCts?.Token ?? cancellationToken);
await handler.HandleAsync(@event, next, linkedCts?.Token ?? cancellationToken).ConfigureAwait(false);
Log.Debug("Around handler completed: {0}", handler.GetType().Name);
}
@ -296,4 +296,4 @@ public class SceneTransitionPipeline
throw;
}
}
}
}

View File

@ -133,7 +133,7 @@ public class UiTransitionPipeline
foreach (var handler in sortedHandlers)
{
var options = _options[handler];
await ExecuteSingleHandlerAsync(handler, options, @event, cancellationToken);
await ExecuteSingleHandlerAsync(handler, options, @event, cancellationToken).ConfigureAwait(false);
}
Log.Debug("Pipeline execution completed for phases: {0}", phases);
@ -158,7 +158,7 @@ public class UiTransitionPipeline
if (handlers.Count == 0)
{
await coreAction();
await coreAction().ConfigureAwait(false);
return;
}
@ -176,11 +176,11 @@ public class UiTransitionPipeline
var options = _aroundOptions[handler];
var next = pipeline;
pipeline = async () => await ExecuteSingleAroundHandlerAsync(
pipeline = () => ExecuteSingleAroundHandlerAsync(
handler, options, @event, next, cancellationToken);
}
await pipeline();
await pipeline().ConfigureAwait(false);
}
private List<IUiTransitionHandler> FilterAndSortHandlers(
@ -268,7 +268,7 @@ public class UiTransitionPipeline
? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, timeoutCts.Token)
: null;
await handler.HandleAsync(@event, next, linkedCts?.Token ?? cancellationToken);
await handler.HandleAsync(@event, next, linkedCts?.Token ?? cancellationToken).ConfigureAwait(false);
Log.Debug("Around handler completed: {0}", handler.GetType().Name);
}
@ -281,4 +281,4 @@ public class UiTransitionPipeline
throw;
}
}
}
}