Further decrease server load

We can keep inventory checksum before deduplication in the cache. If it's determined to be the same, then our inventory state didn't change, so it also doesn't make much sense to ask server for set parts and announcement.
This commit is contained in:
Archi
2023-11-29 14:26:57 +01:00
parent a3270e4081
commit aea9dee4ea
2 changed files with 58 additions and 6 deletions

View File

@@ -50,9 +50,25 @@ internal sealed class BotCache : SerializableFile {
}
}
internal string? LastInventoryChecksumBeforeDeduplication {
get => BackingLastInventoryChecksumBeforeDeduplication;
set {
if (BackingLastInventoryChecksumBeforeDeduplication == value) {
return;
}
BackingLastInventoryChecksumBeforeDeduplication = value;
Utilities.InBackground(Save);
}
}
[JsonProperty]
private string? BackingLastAnnouncedTradeToken;
[JsonProperty]
private string? BackingLastInventoryChecksumBeforeDeduplication;
private BotCache(string filePath) : this() {
ArgumentException.ThrowIfNullOrEmpty(filePath);
@@ -65,6 +81,9 @@ internal sealed class BotCache : SerializableFile {
[UsedImplicitly]
public bool ShouldSerializeBackingLastAnnouncedTradeToken() => !string.IsNullOrEmpty(BackingLastAnnouncedTradeToken);
[UsedImplicitly]
public bool ShouldSerializeBackingLastInventoryChecksumBeforeDeduplication() => !string.IsNullOrEmpty(BackingLastInventoryChecksumBeforeDeduplication);
[UsedImplicitly]
public bool ShouldSerializeLastAnnouncedAssetsForListing() => LastAnnouncedAssetsForListing.Count > 0;