Workaround stale cache of CM servers

This commit is contained in:
Łukasz Domeradzki
2024-10-14 13:42:29 +02:00
parent fc64511268
commit 5a9750a4b6
2 changed files with 3 additions and 20 deletions

View File

@@ -49,7 +49,6 @@ using ArchiSteamFarm.Web.GitHub.Data;
using ArchiSteamFarm.Web.Responses;
using JetBrains.Annotations;
using SteamKit2;
using SteamKit2.Discovery;
namespace ArchiSteamFarm.Core;
@@ -676,22 +675,9 @@ public static class ASF {
throw new InvalidOperationException(nameof(WebBrowser));
}
// Ensure that we ask for a list of servers if we don't have any saved servers available
IEnumerable<ServerRecord> servers = await GlobalDatabase.ServerListProvider.FetchServerListAsync().ConfigureAwait(false);
if (!servers.Any()) {
ArchiLogger.LogGenericInfo(Strings.FormatInitializing(nameof(SteamDirectory)));
SteamConfiguration steamConfiguration = SteamConfiguration.Create(static builder => builder.WithProtocolTypes(GlobalConfig.SteamProtocols).WithCellID(GlobalDatabase.CellID).WithServerListProvider(GlobalDatabase.ServerListProvider).WithHttpClientFactory(static () => WebBrowser.GenerateDisposableHttpClient()));
try {
await SteamDirectory.LoadAsync(steamConfiguration).ConfigureAwait(false);
ArchiLogger.LogGenericInfo(Strings.Success);
} catch (Exception e) {
ArchiLogger.LogGenericWarningException(e);
ArchiLogger.LogGenericWarning(Strings.BotSteamDirectoryInitializationFailed);
}
}
// Kill SK2 servers cache in order to force refresh during initial connection
// TODO: This should be removed when SK2 learns to purge its stale cache itself
await GlobalDatabase.ServerListProvider.UpdateServerListAsync([]).ConfigureAwait(false);
HashSet<string> botNames;

View File

@@ -487,9 +487,6 @@ StackTrace:
<data name="BotHeartBeatFailed" xml:space="preserve">
<value>Failed to disconnect the client. Abandoning this bot instance!</value>
</data>
<data name="BotSteamDirectoryInitializationFailed" xml:space="preserve">
<value>Could not initialize SteamDirectory: connecting with Steam Network might take much longer than usual!</value>
</data>
<data name="BotStopping" xml:space="preserve">
<value>Stopping...</value>
</data>