Skip to content

Commit 33c8c43

Browse files
committed
[修复]1. 修复处理器重复处理的BUG
2. 修改处理器处理的判断优先级
1 parent b4157ba commit 33c8c43

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

GameFrameX.Core/BaseHandler/BaseMessageHandler.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,29 @@ public virtual async Task InnerAction(int timeout = 30000, CancellationToken can
8989
/// <returns>动作执行任务</returns>
9090
protected async Task InnerActionAsync()
9191
{
92-
if (GlobalSettings.IsDebug)
92+
if (GlobalSettings.IsMonitorTimeOut)
9393
{
9494
_stopwatch.Restart();
9595
await ActionAsync();
9696
_stopwatch.Stop();
97-
LogHelper.Debug($"消息处理器:{GetType().Name},UniqueId:{Message.UniqueId} 执行耗时:{_stopwatch.ElapsedMilliseconds} ms");
97+
if (_stopwatch.Elapsed.Seconds >= GlobalSettings.MonitorTimeOutSeconds)
98+
{
99+
LogHelper.Warn($"消息处理器:{GetType().Name},UniqueId:{Message.UniqueId} 执行耗时:{_stopwatch.ElapsedMilliseconds} ms");
100+
}
101+
102+
return;
98103
}
99104

100-
if (GlobalSettings.IsMonitorTimeOut)
105+
if (GlobalSettings.IsDebug)
101106
{
102107
_stopwatch.Restart();
103108
await ActionAsync();
104109
_stopwatch.Stop();
105-
if (_stopwatch.Elapsed.Seconds >= GlobalSettings.MonitorTimeOutSeconds)
106-
{
107-
LogHelper.Warn($"消息处理器:{GetType().Name},UniqueId:{Message.UniqueId} 执行耗时:{_stopwatch.ElapsedMilliseconds} ms");
108-
}
110+
LogHelper.Debug($"消息处理器:{GetType().Name},UniqueId:{Message.UniqueId} 执行耗时:{_stopwatch.ElapsedMilliseconds} ms");
111+
return;
109112
}
110113

114+
111115
await ActionAsync();
112116
}
113117
}

0 commit comments

Comments
 (0)