Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

fix: dead lock in RevertManager and add CI/Release timeout (30s)

fatDuck856d5178d5fd
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8e2de6d..ddc32e9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -32,4 +32,4 @@ jobs:
run: dotnet build optimizerDuck.slnx --configuration Release --no-restore
- name: Test
- run: dotnet test optimizerDuck.Test/optimizerDuck.Test.csproj --configuration Release --no-build
+ run: dotnet test optimizerDuck.Test/optimizerDuck.Test.csproj --configuration Release --no-build --logger "console;verbosity=detailed" --blame-hang --blame-hang-timeout 30s
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4e41027..220391f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -29,7 +29,7 @@ jobs:
run: dotnet build optimizerDuck.slnx --configuration Release --no-restore
- name: Test
- run: dotnet test optimizerDuck.Test/optimizerDuck.Test.csproj --configuration Release --no-restore
+ run: dotnet test optimizerDuck.Test/optimizerDuck.Test.csproj --configuration Release --logger "console;verbosity=detailed" --blame-hang --blame-hang-timeout 30s
- name: Publish Single
run: |
diff --git a/optimizerDuck/Services/Revert/RevertManager.cs b/optimizerDuck/Services/Revert/RevertManager.cs
index 964d6f0..f9b75b7 100644
--- a/optimizerDuck/Services/Revert/RevertManager.cs
+++ b/optimizerDuck/Services/Revert/RevertManager.cs
@@ -181,7 +181,7 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
try
{
var data =
- await LoadAsync(filePath)
+ await LoadAsyncUnlocked(filePath)
?? new RevertData
{
SchemaVersion = SchemaVersion,
@@ -268,6 +268,21 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
await lockObj.WaitAsync().ConfigureAwait(false);
}
+ try
+ {
+ return await LoadAsyncUnlocked(path);
+ }
+ finally
+ {
+ lockObj?.Release();
+ }
+ }
+
+ private static async Task<RevertData?> LoadAsyncUnlocked(string path)
+ {
+ if (!File.Exists(path))
+ return null;
+
try
{
for (var i = 0; i < 3; i++)
@@ -297,10 +312,6 @@ public class RevertManager(ILogger<RevertManager> _logger, ILoggerFactory _logge
TraceCorruptRevertFile(path, ex);
return null;
}
- finally
- {
- lockObj?.Release();
- }
}
private static Guid? ExtractIdFromPath(string path)