From e4b0e22fa3f1cb6f60899a201ee53b13c057287a Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Fri, 10 Jul 2020 11:23:39 -0400 Subject: [PATCH] Fix bad setting of BYOND topic timeouts --- .../Database/DatabaseSeeder.cs | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/Tgstation.Server.Host/Database/DatabaseSeeder.cs b/src/Tgstation.Server.Host/Database/DatabaseSeeder.cs index 5b2fbde5ba..8982ce2205 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseSeeder.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseSeeder.cs @@ -133,32 +133,35 @@ namespace Tgstation.Server.Host.Database instance.Path = instance.Path.Replace('\\', '/'); } - var ids = await databaseContext - .DreamDaemonSettings - .AsQueryable() - .Where(x => x.TopicRequestTimeout == 0) - .Select(x => x.Id) - .ToListAsync(cancellationToken) - .ConfigureAwait(false); - - var rowsUpdated = ids.Count; - foreach (var id in ids) + if (generalConfiguration.ByondTopicTimeout != 0) { - var newDDSettings = new DreamDaemonSettings + var ids = await databaseContext + .DreamDaemonSettings + .AsQueryable() + .Where(x => x.TopicRequestTimeout == 0) + .Select(x => x.Id) + .ToListAsync(cancellationToken) + .ConfigureAwait(false); + + var rowsUpdated = ids.Count; + foreach (var id in ids) { - Id = id - }; + var newDDSettings = new DreamDaemonSettings + { + Id = id + }; - databaseContext.DreamDaemonSettings.Attach(newDDSettings); - newDDSettings.TopicRequestTimeout = generalConfiguration.ByondTopicTimeout; + databaseContext.DreamDaemonSettings.Attach(newDDSettings); + newDDSettings.TopicRequestTimeout = generalConfiguration.ByondTopicTimeout; + } + + if (rowsUpdated > 0) + logger.LogInformation( + "Updated {0} instances to use database backed BYOND topic timeouts from configuration setting of {1}", + rowsUpdated, + generalConfiguration.ByondTopicTimeout); } - if (rowsUpdated > 0) - logger.LogInformation( - "Updated {0} instances to use database backed BYOND topic timeouts from configuration setting of {1}", - rowsUpdated, - generalConfiguration.ByondTopicTimeout); - await databaseContext.Save(cancellationToken).ConfigureAwait(false); }