diff --git a/server/src/Controllers/JtagController.cs b/server/src/Controllers/JtagController.cs index bf4670c..b1a86b8 100644 --- a/server/src/Controllers/JtagController.cs +++ b/server/src/Controllers/JtagController.cs @@ -183,7 +183,7 @@ public class JtagController : ControllerBase logger.Info($"User {username} processing bitstream file of size: {fileBytes.Length} bytes"); // 定义进度跟踪 - var taskId = _tracker.CreateTask(1000); + var taskId = _tracker.CreateTask(10000); _tracker.AdvanceProgress(taskId, 10); _ = Task.Run(async () => diff --git a/server/src/Hubs/ProgressHub.cs b/server/src/Hubs/ProgressHub.cs index 3f153d1..15dfdae 100644 --- a/server/src/Hubs/ProgressHub.cs +++ b/server/src/Hubs/ProgressHub.cs @@ -37,7 +37,7 @@ public class ProgressInfo { public required string TaskId { get; set; } public required ProgressStatus Status { get; set; } - public required int ProgressPercent { get; set; } + public required double ProgressPercent { get; set; } public required string ErrorMessage { get; set; } }; diff --git a/server/src/Services/ProgressTracker.cs b/server/src/Services/ProgressTracker.cs index 27f34dc..eac1fee 100644 --- a/server/src/Services/ProgressTracker.cs +++ b/server/src/Services/ProgressTracker.cs @@ -50,7 +50,7 @@ public readonly struct TaskProgress TaskState.Cancelled => ProgressStatus.Canceled, _ => ProgressStatus.Failed }, - ProgressPercent = Total > 0 ? (Current * 100) / Total : 0, + ProgressPercent = Total > 0 ? ((double)Current * 100) / (double)Total : 0, ErrorMessage = Error ?? string.Empty }; } diff --git a/server/src/UdpClientPool.cs b/server/src/UdpClientPool.cs index 12113ff..9660e87 100644 --- a/server/src/UdpClientPool.cs +++ b/server/src/UdpClientPool.cs @@ -677,7 +677,7 @@ public sealed class UDPClientPool if (!udpWriteAck.Value.IsSuccessful) return false; - _progressTracker.AdvanceProgress(progressId, 5); + _progressTracker.AdvanceProgress(progressId, 1); } return true; diff --git a/src/utils/signalR/server.Hubs.ts b/src/utils/signalR/server.Hubs.ts index 9726bda..647c84f 100644 --- a/src/utils/signalR/server.Hubs.ts +++ b/src/utils/signalR/server.Hubs.ts @@ -24,7 +24,7 @@ export type ProgressInfo = { taskId: string; /** Transpiled from server.Hubs.ProgressStatus */ status: ProgressStatus; - /** Transpiled from int */ + /** Transpiled from double */ progressPercent: number; /** Transpiled from string */ errorMessage: string;