From 0bd4eaf9db46268e9cb5ac26ecb26a9d556477ae Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Thu, 23 Nov 2023 18:59:40 -0500 Subject: [PATCH] Nullify `ServerUpdater` --- .../Core/ServerUpdater.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Tgstation.Server.Host/Core/ServerUpdater.cs b/src/Tgstation.Server.Host/Core/ServerUpdater.cs index be3b9f033c..8c9d968168 100644 --- a/src/Tgstation.Server.Host/Core/ServerUpdater.cs +++ b/src/Tgstation.Server.Host/Core/ServerUpdater.cs @@ -11,8 +11,6 @@ using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Swarm; using Tgstation.Server.Host.Utils.GitHub; -#nullable disable - namespace Tgstation.Server.Host.Core { /// @@ -61,7 +59,7 @@ namespace Tgstation.Server.Host.Core /// /// for an in-progress update operation. /// - ServerUpdateOperation serverUpdateOperation; + ServerUpdateOperation? serverUpdateOperation; /// /// Initializes a new instance of the class. @@ -94,7 +92,7 @@ namespace Tgstation.Server.Host.Core } /// - public async ValueTask BeginUpdate(ISwarmService swarmService, IFileStreamProvider fileStreamProvider, Version version, CancellationToken cancellationToken) + public async ValueTask BeginUpdate(ISwarmService swarmService, IFileStreamProvider? fileStreamProvider, Version version, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(swarmService); @@ -203,7 +201,7 @@ namespace Tgstation.Server.Host.Core { try { - await serverUpdateOperation.SwarmService.AbortUpdate(); + await serverUpdateOperation!.SwarmService.AbortUpdate(); } catch (Exception e2) { @@ -216,11 +214,11 @@ namespace Tgstation.Server.Host.Core /// /// The directory the server update is initially extracted to. /// The for the operation. - /// A resulting in containing a new based on the of and if it needs to be kept active until the swarm commit. + /// A resulting in containing a new based on the of and if it needs to be kept active until the swarm commit. If , the update failed to prepare. /// Requires to be populated. - async ValueTask> PrepareUpdateClearStagingAndBufferStream(string stagingDirectory, CancellationToken cancellationToken) + async ValueTask?> PrepareUpdateClearStagingAndBufferStream(string stagingDirectory, CancellationToken cancellationToken) { - await using var fileStreamProvider = serverUpdateOperation.FileStreamProvider; + await using var fileStreamProvider = serverUpdateOperation!.FileStreamProvider; var bufferedStream = new BufferedFileStreamProvider( await fileStreamProvider.GetResult(cancellationToken)); @@ -278,12 +276,12 @@ namespace Tgstation.Server.Host.Core /// A resulting in the . async ValueTask BeginUpdateImpl( ISwarmService swarmService, - IFileStreamProvider fileStreamProvider, + IFileStreamProvider? fileStreamProvider, Version newVersion, bool recursed, CancellationToken cancellationToken) { - ServerUpdateOperation ourUpdateOperation = null; + ServerUpdateOperation? ourUpdateOperation = null; try { if (fileStreamProvider == null)