UpdateAsync don't work here.

This commit is contained in:
Jordan Brown
2020-06-16 20:50:48 -04:00
parent 13b83a095c
commit ca01f40f1a
@@ -133,16 +133,26 @@ namespace Tgstation.Server.Host.Database
instance.Path = instance.Path.Replace('\\', '/');
}
// Update settings from config
var rowsUpdated = await databaseContext
var ids = await databaseContext
.DreamDaemonSettings
.AsQueryable()
.Where(x => x.TopicRequestTimeout == 0)
.UpdateAsync(
settings => new DreamDaemonSettings { TopicRequestTimeout = generalConfiguration.ByondTopicTimeout },
cancellationToken)
.Select(x => x.Id)
.ToListAsync(cancellationToken)
.ConfigureAwait(false);
var rowsUpdated = ids.Count;
foreach (var id in ids)
{
var newDDSettings = new DreamDaemonSettings
{
Id = id
};
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}",