Skip to content

Commit

Permalink
Don't treat timeouts as crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
KimihikoAkayasaki committed Jun 5, 2024
1 parent 52f842e commit 06e7cf3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Amethyst/Amethyst.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<Description>Amethyst (Desktop) App</Description>
<PackageProjectUrl>k2vr.tech</PackageProjectUrl>
<!--AZ_BUILD_DATA<Version>AZ_BUILD_NUMBER</Version>AZ_BUILD_DATA-->
<FileVersion>1.2.13.0</FileVersion>
<AssemblyVersion>1.2.13.0</AssemblyVersion>
<FileVersion>1.2.14.0</FileVersion>
<AssemblyVersion>1.2.14.0</AssemblyVersion>
<RepositoryUrl>https://github.com/KinectToVR/Amethyst</RepositoryUrl>
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
</PropertyGroup>
Expand Down
7 changes: 5 additions & 2 deletions Amethyst/Classes/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,15 @@ public static async void MainLoop()
{
serverLoops = 0; // Reset the counter for the next 10'000 service loops
var elapsedTicks = loopStopWatch.ElapsedTicks; // Cache the elapsed time
await Task.Delay(TimeSpan.FromTicks(diffTicks));
await Task.Delay(TimeSpan.FromTicks(diffTicks), cancellationToken.Token);

Logger.Info($"10000 loops have passed: this loop took {elapsedTicks} [ticks], " +
$"the loop's time after time correction (sleep) is: {loopStopWatch.ElapsedTicks} [ticks]");
}
else
{
serverLoops++; // Else increase passed loops counter and wait
await Task.Delay(TimeSpan.FromTicks(diffTicks));
await Task.Delay(TimeSpan.FromTicks(diffTicks), cancellationToken.Token);
}

#pragma warning disable CA1806 // Do not ignore method results
Expand All @@ -623,6 +623,9 @@ public static async void MainLoop()
serverTries++; // One more?
switch (serverTries)
{
case > 0 when e is TaskCanceledException:
break; // It's probably the token timeout, just don't care...

case > 3 and <= 7:
// We've crashed the third time now. Something's off.. really...
Logger.Fatal(new AggregateException(
Expand Down
2 changes: 1 addition & 1 deletion Amethyst/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="11835K2VRTeam.Amethyst-OpenSourceBodyTracking"
Publisher="CN=91B2E3DA-4470-40D2-806F-0A45A7911612"
Version="1.2.13.0" />
Version="1.2.14.0" />

<Properties>
<DisplayName>Amethyst - Open Source Body Tracking</DisplayName>
Expand Down

0 comments on commit 06e7cf3

Please sign in to comment.