From dd6ba6e65a0097d83e29c16adfea31b5aeb34f57 Mon Sep 17 00:00:00 2001 From: Dominion Date: Wed, 22 Mar 2023 10:45:24 -0400 Subject: [PATCH 1/4] Detaching a deleted instance doesn't throw --- src/Tgstation.Server.Host/Controllers/InstanceController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Controllers/InstanceController.cs b/src/Tgstation.Server.Host/Controllers/InstanceController.cs index f357240410..b10390820b 100644 --- a/src/Tgstation.Server.Host/Controllers/InstanceController.cs +++ b/src/Tgstation.Server.Host/Controllers/InstanceController.cs @@ -303,7 +303,8 @@ namespace Tgstation.Server.Host.Controllers var attachFileName = ioManager.ConcatPath(originalModel.Path, InstanceAttachFileName); try { - await ioManager.WriteAllBytes(attachFileName, Array.Empty(), cancellationToken); + if (await ioManager.DirectoryExists(originalModel.Path, cancellationToken)) + await ioManager.WriteAllBytes(attachFileName, Array.Empty(), cancellationToken); } catch (OperationCanceledException) { From 0942f08fda2a952332f8344046a1eb714899b3fd Mon Sep 17 00:00:00 2001 From: Dominion Date: Fri, 24 Mar 2023 14:12:33 -0400 Subject: [PATCH 2/4] Fix a formatting error in GitHub Deployment comments --- .../Deployment/Remote/GitHubRemoteDeploymentManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs index a76434e9a1..5731c82b2a 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/Remote/GitHubRemoteDeploymentManager.cs @@ -305,7 +305,7 @@ namespace Tgstation.Server.Host.Components.Deployment.Remote compileJob.RevisionInformation.OriginCommitSha, compileJob.RevisionInformation.CommitSha, compileJob.GitHubDeploymentId.HasValue - ? $"{Environment.NewLine}[GitHub Deployments](https://github.com/{remoteRepositoryOwner}/{remoteRepositoryName}/deployments/activity_log?environment=TGS%3A%20{Metadata.Name})" + ? $"{Environment.NewLine}[GitHub Deployments](https://github.com/{remoteRepositoryOwner}/{remoteRepositoryName}/deployments/activity_log?environment=TGS%3A+{Metadata.Name.Replace(" ", "+", StringComparison.Ordinal)})" : String.Empty); /// From 8f4ba0bcf3651521e01ee915f598b08d017488d2 Mon Sep 17 00:00:00 2001 From: Dominion Date: Fri, 24 Mar 2023 14:26:14 -0400 Subject: [PATCH 3/4] Improve responsiveness of current DreamMaker stage --- .../Components/Deployment/DreamMaker.cs | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs index e8464b0d89..1838dceeb7 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs @@ -719,18 +719,40 @@ namespace Tgstation.Server.Host.Components.Deployment { var noEstimate = !estimatedDuration.HasValue; progressReporter.StageName = currentStage; - progressReporter.ReportProgress(noEstimate ? null : 0); + double? lastReport = noEstimate ? null : 0; + progressReporter.ReportProgress(lastReport); - var sleepInterval = estimatedDuration.HasValue ? estimatedDuration.Value / 100 : TimeSpan.FromMilliseconds(250); + var minimumSleepInterval = TimeSpan.FromMilliseconds(250); + var sleepInterval = estimatedDuration.HasValue ? estimatedDuration.Value / 100 : minimumSleepInterval; + + if (estimatedDuration.HasValue) + { + logger.LogDebug("Compile is expected to take: {0}", estimatedDuration); + } + else + { + logger.LogTrace("No metric to estimate compile time."); + } - logger.LogDebug("Compile is expected to take: {0}", estimatedDuration); try { for (var iteration = 0; iteration < (estimatedDuration.HasValue ? 99 : Int32.MaxValue); ++iteration) { - await Task.Delay(sleepInterval, cancellationToken); + var nextInterval = DateTimeOffset.Now + sleepInterval; + do + { + var remainingSleepThisInterval = nextInterval - DateTimeOffset.Now; + var nextSleepSpan = remainingSleepThisInterval < minimumSleepInterval ? remainingSleepThisInterval : minimumSleepInterval; + + await Task.Delay(nextSleepSpan, cancellationToken); + progressReporter.StageName = currentStage; + progressReporter.ReportProgress(lastReport); + } + while (DateTimeOffset.Now < nextInterval); + progressReporter.StageName = currentStage; - progressReporter.ReportProgress(noEstimate ? null : sleepInterval * (iteration + 1) / estimatedDuration.Value); + lastReport = noEstimate ? null : sleepInterval * (iteration + 1) / estimatedDuration.Value; + progressReporter.ReportProgress(lastReport); } } catch (OperationCanceledException) From fdb3672e52f2af1be562d1a67c259ffe33a621bf Mon Sep 17 00:00:00 2001 From: Dominion Date: Fri, 24 Mar 2023 14:26:59 -0400 Subject: [PATCH 4/4] Version bump to 5.3.3 --- build/Version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Version.props b/build/Version.props index 61d13ad89d..a165f87f99 100644 --- a/build/Version.props +++ b/build/Version.props @@ -3,7 +3,7 @@ - 5.3.2 + 5.3.3 4.4.0 9.8.1 10.2.0