From 48d58bb60e077882bfc496db5b2a33eecb5ccad9 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 5 Sep 2021 19:40:19 -0400 Subject: [PATCH 1/3] Fix auto updater creating conflicting RevInfos --- .../Components/Instance.cs | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Instance.cs b/src/Tgstation.Server.Host/Components/Instance.cs index b591c8f401..6d5378dc93 100644 --- a/src/Tgstation.Server.Host/Components/Instance.cs +++ b/src/Tgstation.Server.Host/Components/Instance.cs @@ -308,19 +308,22 @@ namespace Tgstation.Server.Host.Components cancellationToken) .ConfigureAwait(false); - Task LoadRevInfo() => databaseContext.RevisionInformations - .AsQueryable() - .Where(x => x.CommitSha == startSha && x.Instance.Id == metadata.Id) - .Include(x => x.ActiveTestMerges).ThenInclude(x => x.TestMerge) - .FirstOrDefaultAsync(cancellationToken); - - RevisionInformation currentRevInfo = null; var hasDbChanges = false; + RevisionInformation currentRevInfo = null; Models.Instance attachedInstance = null; async Task UpdateRevInfo(string currentHead, bool onOrigin, IEnumerable updatedTestMerges) { if (currentRevInfo == null) - currentRevInfo = await LoadRevInfo().ConfigureAwait(false); + { + logger.LogTrace("Loading revision info for commit {0}...", startSha.Substring(0, 7)); + currentRevInfo = await databaseContext + .RevisionInformations + .AsQueryable() + .Where(x => x.CommitSha == startSha && x.Instance.Id == metadata.Id) + .Include(x => x.ActiveTestMerges) + .ThenInclude(x => x.TestMerge) + .FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false); + } if (currentRevInfo == default) { @@ -328,6 +331,12 @@ namespace Tgstation.Server.Host.Components onOrigin = true; } + if (currentRevInfo.CommitSha == currentHead) + { + logger.LogTrace("Not updating rev-info, already in DB."); + return; + } + if (attachedInstance == null) { attachedInstance = new Models.Instance @@ -347,6 +356,7 @@ namespace Tgstation.Server.Host.Components : await repo.GetOriginSha(cancellationToken).ConfigureAwait(false), Instance = attachedInstance, }; + if (!onOrigin) currentRevInfo.ActiveTestMerges = new List( updatedTestMerges ?? oldRevInfo.ActiveTestMerges); From 58b6e1fb178896fc0c9d6b3f9a6700e9fc5e534b Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 5 Sep 2021 19:40:42 -0400 Subject: [PATCH 2/3] Version bump to 4.14.2 --- build/Version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Version.props b/build/Version.props index 0d6b6a923c..82a4caba04 100644 --- a/build/Version.props +++ b/build/Version.props @@ -3,7 +3,7 @@ - 4.14.1 + 4.14.2 4.0.0 9.2.0 9.2.0 From b885ea34772d36789e3cd45bdd152d14aaaecfb1 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 5 Sep 2021 19:50:26 -0400 Subject: [PATCH 3/3] Prevent private channels from being broadcast to Fixes #1316 --- src/Tgstation.Server.Host/Components/Chat/ChatManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs index 26b2386157..657fc57256 100644 --- a/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs +++ b/src/Tgstation.Server.Host/Components/Chat/ChatManager.cs @@ -501,7 +501,10 @@ namespace Tgstation.Server.Host.Components.Chat : $"TGS: Updating to version {updateVersion}..."; List wdChannels; lock (mappedChannels) // so it doesn't change while we're using it - wdChannels = mappedChannels.Select(x => x.Key).ToList(); + wdChannels = mappedChannels + .Where(x => !x.Value.Channel.IsPrivateChannel) + .Select(x => x.Key) + .ToList(); return SendMessage(message, wdChannels, cancellationToken); }