From 0932c8ba752358ed0beb72daf5d0f10a435ed08d Mon Sep 17 00:00:00 2001 From: SikongJueluo Date: Wed, 20 Aug 2025 16:55:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8Dhub?= =?UTF-8?q?=E7=9A=84scantask=E7=9A=84key=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/Hubs/DigitalTubesHub.cs | 10 +++++----- server/src/Hubs/OscilloscopeHub.cs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/src/Hubs/DigitalTubesHub.cs b/server/src/Hubs/DigitalTubesHub.cs index 809c838..999d9b7 100644 --- a/server/src/Hubs/DigitalTubesHub.cs +++ b/server/src/Hubs/DigitalTubesHub.cs @@ -70,7 +70,7 @@ public class DigitalTubesHub : Hub, IDigitalTubesHub private readonly IHubContext _hubContext; private readonly Database.UserManager _userManager = new(); - private ConcurrentDictionary<(string, string), DigitalTubesScanTaskInfo> _scanTasks = new(); + private ConcurrentDictionary _scanTasks = new(); public DigitalTubesHub(IHubContext hubContext) { @@ -160,7 +160,7 @@ public class DigitalTubesHub : Hub, IDigitalTubesHub try { var board = TryGetBoard().OrThrow(() => new Exception("Board not found")); - var key = (board.ID.ToString(), Context.ConnectionId); + var key = board.ID.ToString(); if (_scanTasks.TryGetValue(key, out var existing) && existing.IsRunning) return true; @@ -187,7 +187,7 @@ public class DigitalTubesHub : Hub, IDigitalTubesHub try { var board = TryGetBoard().OrThrow(() => new Exception("Board not found")); - var key = (board.ID.ToString(), Context.ConnectionId); + var key = board.ID.ToString(); if (_scanTasks.TryRemove(key, out var scanInfo)) { @@ -214,7 +214,7 @@ public class DigitalTubesHub : Hub, IDigitalTubesHub return false; var board = TryGetBoard().OrThrow(() => new Exception("Board not found")); - var key = (board.ID.ToString(), Context.ConnectionId); + var key = board.ID.ToString(); if (_scanTasks.TryGetValue(key, out var scanInfo) && scanInfo.IsRunning) { @@ -239,7 +239,7 @@ public class DigitalTubesHub : Hub, IDigitalTubesHub try { var board = TryGetBoard().OrThrow(() => new Exception("Board not found")); - var key = (board.ID.ToString(), Context.ConnectionId); + var key = board.ID.ToString(); if (_scanTasks.TryGetValue(key, out var scanInfo)) { diff --git a/server/src/Hubs/OscilloscopeHub.cs b/server/src/Hubs/OscilloscopeHub.cs index 38da0db..fffd71e 100644 --- a/server/src/Hubs/OscilloscopeHub.cs +++ b/server/src/Hubs/OscilloscopeHub.cs @@ -86,7 +86,7 @@ public class OscilloscopeHub : Hub, IOscilloscopeHub private readonly IHubContext _hubContext; private readonly Database.UserManager _userManager = new(); - private ConcurrentDictionary<(string, string), OscilloscopeScanTaskInfo> _scanTasks = new(); + private ConcurrentDictionary _scanTasks = new(); public OscilloscopeHub(IHubContext hubContext) { @@ -176,7 +176,7 @@ public class OscilloscopeHub : Hub, IOscilloscopeHub try { var board = TryGetBoard().OrThrow(() => new Exception("Board not found")); - var key = (board.ID.ToString(), Context.ConnectionId); + var key = board.ID.ToString(); var client = GetOscilloscope().OrThrow(() => new Exception("Oscilloscope not found")); if (_scanTasks.TryGetValue(key, out var existing)) @@ -210,7 +210,7 @@ public class OscilloscopeHub : Hub, IOscilloscopeHub var board = TryGetBoard().OrThrow(() => new Exception("Board not found")); var client = GetOscilloscope().OrThrow(() => new Exception("Oscilloscope not found")); - var key = (board.ID.ToString(), Context.ConnectionId); + var key = board.ID.ToString(); if (_scanTasks.TryRemove(key, out var taskInfo)) { @@ -383,7 +383,7 @@ public class OscilloscopeHub : Hub, IOscilloscopeHub return false; var board = TryGetBoard().OrThrow(() => new Exception("Board not found")); - var key = (board.ID.ToString(), Context.ConnectionId); + var key = board.ID.ToString(); if (_scanTasks.TryGetValue(key, out var scanInfo)) {