From b3739186006e63bf8a490ae5da98112b613fc846 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Tue, 20 Dec 2022 22:24:33 +1100 Subject: [PATCH 1/3] Update submodule to 0.73.0.0 (#13114) --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index e64d499000..2aafb21772 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit e64d499000f61792a092c21c8444c643055ac754 +Subproject commit 2aafb21772f39216fed2561e309036f4b8c68eec From cd803a82bdec6f5da1323c328c218dec37b875fb Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Tue, 20 Dec 2022 12:33:57 +0100 Subject: [PATCH 2/3] Update projects to C# 11 (#13111) --- Content.Benchmarks/Content.Benchmarks.csproj | 2 +- Content.Client/Content.Client.csproj | 2 +- Content.IntegrationTests/Content.IntegrationTests.csproj | 2 +- Content.Server.Database/Content.Server.Database.csproj | 2 +- Content.Server/Content.Server.csproj | 2 +- Content.Shared/Content.Shared.csproj | 2 +- Content.Tests/Content.Tests.csproj | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Content.Benchmarks/Content.Benchmarks.csproj b/Content.Benchmarks/Content.Benchmarks.csproj index 5c4a052168..a9a5767dde 100644 --- a/Content.Benchmarks/Content.Benchmarks.csproj +++ b/Content.Benchmarks/Content.Benchmarks.csproj @@ -8,7 +8,7 @@ false Exe true - 10 + 11 diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index cad7fd5ec4..79c76cc335 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 10 + 11 false false ..\bin\Content.Client\ diff --git a/Content.IntegrationTests/Content.IntegrationTests.csproj b/Content.IntegrationTests/Content.IntegrationTests.csproj index 6bcb65185b..cb65b50664 100644 --- a/Content.IntegrationTests/Content.IntegrationTests.csproj +++ b/Content.IntegrationTests/Content.IntegrationTests.csproj @@ -6,7 +6,7 @@ ..\bin\Content.IntegrationTests\ false false - 10 + 11 diff --git a/Content.Server.Database/Content.Server.Database.csproj b/Content.Server.Database/Content.Server.Database.csproj index da47c22e2a..a9e6c98b25 100644 --- a/Content.Server.Database/Content.Server.Database.csproj +++ b/Content.Server.Database/Content.Server.Database.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 10 + 11 false false ..\bin\Content.Server.Database\ diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index 881c39aea2..75e1a056fa 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 10 + 11 false false ..\bin\Content.Server\ diff --git a/Content.Shared/Content.Shared.csproj b/Content.Shared/Content.Shared.csproj index b29b228b35..3289c28198 100644 --- a/Content.Shared/Content.Shared.csproj +++ b/Content.Shared/Content.Shared.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 10 + 11 false false Release;Debug diff --git a/Content.Tests/Content.Tests.csproj b/Content.Tests/Content.Tests.csproj index 786cb375b5..8751642cf0 100644 --- a/Content.Tests/Content.Tests.csproj +++ b/Content.Tests/Content.Tests.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 10 + 11 false false ..\bin\Content.Tests\ From 4fa2920472ac83662338c6f46074f3b6b8265689 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Tue, 20 Dec 2022 12:52:39 +0100 Subject: [PATCH 3/3] Remove IoCManager.InitThread calls from parallel code. (#13070) --- .../DeviceNetworkingBenchmark.cs | 44 +++++++++---------- .../EntitySystems/GasTileOverlaySystem.cs | 11 +---- Content.Server/Decals/DecalSystem.cs | 2 - 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/Content.Benchmarks/DeviceNetworkingBenchmark.cs b/Content.Benchmarks/DeviceNetworkingBenchmark.cs index 05d533d3f9..27e5000bc0 100644 --- a/Content.Benchmarks/DeviceNetworkingBenchmark.cs +++ b/Content.Benchmarks/DeviceNetworkingBenchmark.cs @@ -19,7 +19,6 @@ namespace Content.Benchmarks; public class DeviceNetworkingBenchmark { private PairTracker _pair = default!; - private IEntityManager _entityManager = default!; private DeviceNetworkTestSystem _deviceNetTestSystem = default!; private DeviceNetworkSystem _deviceNetworkSystem = default!; private EntityUid _sourceEntity; @@ -56,34 +55,35 @@ public class DeviceNetworkingBenchmark public int EntityCount = 500; [GlobalSetup] - public void Setup() + public async Task SetupAsync() { ProgramShared.PathOffset = "../../../../"; - _pair = PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes}).GetAwaiter().GetResult(); + _pair = await PoolManager.GetServerClient(new PoolSettings{NoClient = true, ExtraPrototypes = Prototypes}); var server = _pair.Pair.Server; - _entityManager = server.ResolveDependency(); - _deviceNetworkSystem = _entityManager.EntitySysManager.GetEntitySystem(); - _deviceNetTestSystem = _entityManager.EntitySysManager.GetEntitySystem(); - - IoCManager.InitThread(_pair.Pair.Server.InstanceDependencyCollection); - - var testValue = "test"; - _payload = new NetworkPayload + await server.WaitPost(() => { - ["Test"] = testValue, - ["testnumber"] = 1, - ["testbool"] = true - }; + var entityManager = server.InstanceDependencyCollection.Resolve(); + _deviceNetworkSystem = entityManager.EntitySysManager.GetEntitySystem(); + _deviceNetTestSystem = entityManager.EntitySysManager.GetEntitySystem(); - _sourceEntity = _entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace); - _sourceWirelessEntity = _entityManager.SpawnEntity("DummyWirelessNetworkDevice", MapCoordinates.Nullspace); + var testValue = "test"; + _payload = new NetworkPayload + { + ["Test"] = testValue, + ["testnumber"] = 1, + ["testbool"] = true + }; - for (var i = 0; i < EntityCount; i++) - { - _targetEntities.Add(_entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace)); - _targetWirelessEntities.Add(_entityManager.SpawnEntity("DummyWirelessNetworkDevice", MapCoordinates.Nullspace)); - } + _sourceEntity = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace); + _sourceWirelessEntity = entityManager.SpawnEntity("DummyWirelessNetworkDevice", MapCoordinates.Nullspace); + + for (var i = 0; i < EntityCount; i++) + { + _targetEntities.Add(entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace)); + _targetWirelessEntities.Add(entityManager.SpawnEntity("DummyWirelessNetworkDevice", MapCoordinates.Nullspace)); + } + }); } [Benchmark(Baseline = true, Description = "Entity Events")] diff --git a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs index 3b3acf8a38..77b4781175 100644 --- a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -1,6 +1,5 @@ using System.Linq; using System.Runtime.CompilerServices; -using System.Threading; using System.Threading.Tasks; using Content.Server.Atmos.Components; using Content.Shared.Atmos; @@ -255,17 +254,11 @@ namespace Content.Server.Atmos.EntitySystems // Afterwards we reset all the chunk data for the next time we tick. var players = _playerManager.ServerSessions.Where(x => x.Status == SessionStatus.InGame).ToArray(); var opts = new ParallelOptions { MaxDegreeOfParallelism = _parMan.ParallelProcessCount }; - var mainThread = Thread.CurrentThread; - var parentDeps = IoCManager.Instance!; - Parallel.ForEach(players, opts, p => UpdatePlayer(p, curTick, mainThread, parentDeps)); + Parallel.ForEach(players, opts, p => UpdatePlayer(p, curTick)); } - private void UpdatePlayer(IPlayerSession playerSession, GameTick curTick, Thread mainThread, IDependencyCollection parentDeps) + private void UpdatePlayer(IPlayerSession playerSession, GameTick curTick) { - // Thjs exists JUST to be able to resolve IRobustStringSerializer for networked message sending. - if (mainThread != Thread.CurrentThread) - IoCManager.InitThread(parentDeps.FromParent(parentDeps), true); - var xformQuery = GetEntityQuery(); var chunksInRange = _chunkingSys.GetChunksForSession(playerSession, ChunkSize, xformQuery, _chunkIndexPool, _chunkViewerPool); var previouslySent = _lastSentChunks[playerSession]; diff --git a/Content.Server/Decals/DecalSystem.cs b/Content.Server/Decals/DecalSystem.cs index 7b1dd93aef..ca0d170fb0 100644 --- a/Content.Server/Decals/DecalSystem.cs +++ b/Content.Server/Decals/DecalSystem.cs @@ -482,8 +482,6 @@ namespace Content.Server.Decals public void UpdatePlayer(IPlayerSession player) { - IoCManager.InitThread(_dependencies, replaceExisting: true); - var xformQuery = GetEntityQuery(); var chunksInRange = _chunking.GetChunksForSession(player, ChunkSize, xformQuery, _chunkIndexPool, _chunkViewerPool); var staleChunks = _chunkViewerPool.Get();