diff --git a/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs b/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs index accf1f50de..51dd73083d 100644 --- a/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs +++ b/tests/Tgstation.Server.Tests/Live/DummyChatProvider.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -36,7 +37,7 @@ namespace Tgstation.Server.Tests.Live readonly ICryptographySuite cryptographySuite; readonly CancellationTokenSource randomMessageCts; readonly Task randomMessageTask; - readonly Dictionary knownChannels; + readonly ConcurrentDictionary knownChannels; bool connectedOnce; bool connected; @@ -71,7 +72,7 @@ namespace Tgstation.Server.Tests.Live this.commands = commands ?? throw new ArgumentNullException(nameof(commands)); this.random = random ?? throw new ArgumentNullException(nameof(random)); - knownChannels = new Dictionary(); + knownChannels = new (); randomMessageCts = new CancellationTokenSource(); randomMessageTask = RandomMessageLoop(this.randomMessageCts.Token); } @@ -189,8 +190,7 @@ namespace Tgstation.Server.Tests.Live Tag = channel.Tag, }; - knownChannels.Remove(channelId); - knownChannels.Add(channelId, entry); + knownChannels[channelId] = entry; return CloneChannel(entry); } @@ -255,7 +255,7 @@ namespace Tgstation.Server.Tests.Live // isAdmin and Tag populated by manager }; - knownChannels.Add(channelId, channel); + knownChannels[channelId] = channel; } else {