Fix RoundEndTest obsolete warnings (#39133)
We love using low-leaving threading APIs incorrectly.
This commit is contained in:
committed by
GitHub
parent
378fbb0ba9
commit
65b4b41928
@@ -1,4 +1,3 @@
|
||||
using System.Threading;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.RoundEnd;
|
||||
using Content.Shared.CCVar;
|
||||
@@ -22,7 +21,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
private void OnRoundEnd(RoundEndSystemChangedEvent ev)
|
||||
{
|
||||
Interlocked.Increment(ref RoundCount);
|
||||
RoundCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,13 +126,17 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
async Task WaitForEvent()
|
||||
{
|
||||
var timeout = Task.Delay(TimeSpan.FromSeconds(10));
|
||||
var currentCount = Thread.VolatileRead(ref sys.RoundCount);
|
||||
while (currentCount == Thread.VolatileRead(ref sys.RoundCount) && !timeout.IsCompleted)
|
||||
const int maxTicks = 60;
|
||||
var currentCount = sys.RoundCount;
|
||||
for (var i = 0; i < maxTicks; i++)
|
||||
{
|
||||
await pair.RunTicksSync(5);
|
||||
if (currentCount != sys.RoundCount)
|
||||
return;
|
||||
|
||||
await pair.RunTicksSync(1);
|
||||
}
|
||||
if (timeout.IsCompleted) throw new TimeoutException("Event took too long to trigger");
|
||||
|
||||
throw new TimeoutException("Event took too long to trigger");
|
||||
}
|
||||
|
||||
// Need to clean self up
|
||||
|
||||
Reference in New Issue
Block a user