NewLife/AntJob

手工拼接的 TraceId 要单独处理一下,避免在保存时出问题。
Soar360 authored at 2024-06-03 11:28:55
2f0f2f8
Tree
1 Parent(s) a51e933
Summary: 1 changed files with 6 additions and 1 deletions.
Modified +6 -1
Modified +6 -1
diff --git a/AntJob.Server/Services/JobService.cs b/AntJob.Server/Services/JobService.cs
index df7faf4..72b6989 100644
--- a/AntJob.Server/Services/JobService.cs
+++ b/AntJob.Server/Services/JobService.cs
@@ -350,7 +350,12 @@ public class JobService(AppService appService, ICacheProvider cacheProvider, ILo
         traceId = DefaultSpan.Current?.TraceId;
         if (!traceId.IsNullOrEmpty() && !tis.Contains(traceId)) tis.Add(traceId);
         task.TraceId = tis.Join(",");
-
+        while (true)
+        {
+            if (task.TraceId.Length <= JobTask._.TraceId.Length) break;
+            tis.RemoveAt(0);
+            task.TraceId = tis.Join(",");
+        }
         // 已终结的作业,汇总统计
         if (result.Status == JobStatus.完成 || result.Status == JobStatus.错误)
         {