From a526ff0138109c2680e5a06a3335cae9d3a0866d Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Tue, 7 Aug 2018 13:41:08 -0400 Subject: [PATCH] Log cleaned game directories at init --- .../Components/Compiler/DmbFactory.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Compiler/DmbFactory.cs b/src/Tgstation.Server.Host/Components/Compiler/DmbFactory.cs index 2835269fe8..648a7a095a 100644 --- a/src/Tgstation.Server.Host/Components/Compiler/DmbFactory.cs +++ b/src/Tgstation.Server.Host/Components/Compiler/DmbFactory.cs @@ -205,20 +205,24 @@ namespace Tgstation.Server.Host.Components.Compiler //cleanup var directories = await ioManager.GetDirectories(".", cancellationToken).ConfigureAwait(false); - await Task.WhenAll(directories.Select(async x => + if (directories.Count > 0) { - var nameOnly = ioManager.GetFileName(x); - if (jobUidsToNotErase.Contains(nameOnly.ToUpperInvariant())) - return; - try + logger.LogDebug("Cleaning {0} unused game folders...", directories.Count); + await Task.WhenAll(directories.Select(async x => { - await ioManager.DeleteDirectory(x, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - logger.LogWarning("Error deleting directory {0}! Exception: {1}", x, e); - } - })).ConfigureAwait(false); + var nameOnly = ioManager.GetFileName(x); + if (jobUidsToNotErase.Contains(nameOnly.ToUpperInvariant())) + return; + try + { + await ioManager.DeleteDirectory(x, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + logger.LogWarning("Error deleting directory {0}! Exception: {1}", x, e); + } + })).ConfigureAwait(false); + } } } }