mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-28 07:27:18 +01:00
Fix for reattaching
This commit is contained in:
@@ -79,22 +79,24 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{ }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override async Task InitialLink(SwappableDmbProvider swappableDmbProvider, CancellationToken cancellationToken)
|
||||
protected override async Task InitialLink(CancellationToken cancellationToken)
|
||||
{
|
||||
// The logic to check for an active live directory is in SwappableDmbProvider, so we just do it again here for safety
|
||||
Logger.LogTrace("Hard linking compile job...");
|
||||
|
||||
// Symlinks are counted as a file sometimes??
|
||||
var dirDeleteTask = GameIOManager.DeleteDirectory(swappableDmbProvider.Directory, cancellationToken);
|
||||
await GameIOManager.DeleteFile(swappableDmbProvider.Directory, cancellationToken).ConfigureAwait(false);
|
||||
await dirDeleteTask.ConfigureAwait(false);
|
||||
// Symlinks are counted as a file on linux??
|
||||
if (await GameIOManager.DirectoryExists(ActiveSwappable.Directory, cancellationToken).ConfigureAwait(false))
|
||||
await GameIOManager.DeleteDirectory(ActiveSwappable.Directory, cancellationToken).ConfigureAwait(false);
|
||||
else
|
||||
await GameIOManager.DeleteFile(ActiveSwappable.Directory, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Instead of symlinking to begin with we actually rename the directory
|
||||
await GameIOManager.MoveDirectory(
|
||||
swappableDmbProvider.CompileJob.DirectoryName.ToString(),
|
||||
swappableDmbProvider.Directory,
|
||||
ActiveSwappable.CompileJob.DirectoryName.ToString(),
|
||||
ActiveSwappable.Directory,
|
||||
cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
directoryHardLinked = true;
|
||||
}
|
||||
|
||||
@@ -121,6 +123,12 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
}
|
||||
}
|
||||
|
||||
if (reattachInfo != null)
|
||||
{
|
||||
Logger.LogTrace("Skipping symlink due to reattach");
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.LogTrace("Symlinking compile job...");
|
||||
await ActiveSwappable.MakeActive(cancellationToken).ConfigureAwait(false);
|
||||
Server.Resume();
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
|
||||
try
|
||||
{
|
||||
await InitialLink(ActiveSwappable, cancellationToken).ConfigureAwait(false);
|
||||
await InitialLink(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -237,15 +237,14 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the initial link to the live game directory.
|
||||
/// Create the initial link to the live game directory using <see cref="ActiveSwappable"/>.
|
||||
/// </summary>
|
||||
/// <param name="swappableDmbProvider">The <see cref="SwappableDmbProvider"/> in use.</param>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
|
||||
/// <returns>A <see cref="Task"/> representing the running operation.</returns>
|
||||
protected virtual Task InitialLink(SwappableDmbProvider swappableDmbProvider, CancellationToken cancellationToken)
|
||||
protected virtual Task InitialLink(CancellationToken cancellationToken)
|
||||
{
|
||||
Logger.LogTrace("Symlinking compile job...");
|
||||
return swappableDmbProvider.MakeActive(cancellationToken);
|
||||
return ActiveSwappable.MakeActive(cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user