mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Avoid complete purge on each PICS restart
There is no easy way for us to retrieve access tokens again without a full relog procedure, and those are needed for refresh of packages, which should also be optional due to excessive amount of PICS restarts emitted by Steam. At worst, we'll just have outdated data until a full relog procedure, as opposed to having no data at all until relog procedure...
This commit is contained in:
@@ -191,19 +191,21 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PackagesData.IsEmpty) {
|
||||
PackagesData.Clear();
|
||||
}
|
||||
|
||||
if (!PackagesAccessTokens.IsEmpty) {
|
||||
PackagesAccessTokens.Clear();
|
||||
}
|
||||
|
||||
LastChangeNumber = currentChangeNumber;
|
||||
|
||||
foreach (Bot bot in Bot.Bots.Values.Where(bot => bot.IsConnectedAndLoggedOn && !bot.OwnedPackageIDs.IsEmpty)) {
|
||||
await RefreshPackages(bot, bot.OwnedPackageIDs.Keys.ToDictionary(packageID => packageID, _ => uint.MinValue)).ConfigureAwait(false);
|
||||
Bot? refreshBot = Bot.Bots.Values.FirstOrDefault(bot => bot.IsConnectedAndLoggedOn);
|
||||
|
||||
if (refreshBot == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Dictionary<uint, uint> packageIDs = Bot.Bots.Values.SelectMany(bot => bot.OwnedPackageIDs.Keys).ToDictionary(packageID => packageID, _ => currentChangeNumber);
|
||||
|
||||
if (packageIDs.Count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
await RefreshPackages(refreshBot, packageIDs).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
internal void RefreshPackageAccessTokens(IReadOnlyDictionary<uint, ulong> packageAccessTokens) {
|
||||
@@ -237,7 +239,7 @@ namespace ArchiSteamFarm {
|
||||
await PackagesRefreshSemaphore.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
try {
|
||||
HashSet<uint> packageIDs = packages.Where(package => (package.Key != 0) && (!PackagesData.TryGetValue(package.Key, out (uint ChangeNumber, ImmutableHashSet<uint>? AppIDs) packageData) || (packageData.ChangeNumber < package.Value))).Select(package => package.Key).ToHashSet();
|
||||
HashSet<uint> packageIDs = packages.Where(package => (package.Key != 0) && (!PackagesData.TryGetValue(package.Key, out (uint ChangeNumber, ImmutableHashSet<uint>? AppIDs) previousData) || (previousData.ChangeNumber < package.Value))).Select(package => package.Key).ToHashSet();
|
||||
|
||||
if (packageIDs.Count == 0) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user