diff --git a/src/PlaygroundGrains/BuildGrain.cs b/src/PlaygroundGrains/BuildGrain.cs index 875e29a..877e809 100644 --- a/src/PlaygroundGrains/BuildGrain.cs +++ b/src/PlaygroundGrains/BuildGrain.cs @@ -97,10 +97,7 @@ public class BuildGrain : ProcessGrain, IBuil } finally { - if (Directory.Exists(_tempFolder)) - { - Directory.Delete(_tempFolder, true); - } + DeactivateOnIdle(); } return new BuildResponseDto @@ -109,5 +106,13 @@ public class BuildGrain : ProcessGrain, IBuil Message = "Build failed" }; } + + OnDeactivateAsync() + { + if (Directory.Exists(_tempFolder)) + { + Directory.Delete(_tempFolder, true); + } + } } diff --git a/src/PlaygroundGrains/TemplateGrain.cs b/src/PlaygroundGrains/TemplateGrain.cs index 8b1f50b..f59a1b6 100644 --- a/src/PlaygroundGrains/TemplateGrain.cs +++ b/src/PlaygroundGrains/TemplateGrain.cs @@ -64,10 +64,7 @@ public class TemplateGrain : ProcessGrain, ITestGra } finally { - if (Directory.Exists(_tempFolder)) - { - Directory.Delete(_tempFolder, true); - } + DeactivateOnIdle(); } return new TestResponseDto @@ -82,5 +79,13 @@ public class TestGrain : ProcessGrain, ITestGra Message = "Test failed" }; } + + OnDeactivateAsync() + { + if (Directory.Exists(_tempFolder)) + { + Directory.Delete(_tempFolder, true); + } + } }