Skip to content

Commit

Permalink
Cache the remote version info to avoid continuously re-downloading it
Browse files Browse the repository at this point in the history
  • Loading branch information
drojf committed Jul 30, 2023
1 parent 161a8b8 commit fb82b19
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fileVersionManagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def parseRequirementsList(scanPath, requirementsListString):


class VersionManager:
cachedRemoteVersionInfo = None
localVersionFileName = "installedVersionData.json"
def userDidPartialReinstall(self, gameInstallTimeProbePath):
"""
Expand Down Expand Up @@ -112,7 +113,12 @@ def __init__(self, fullInstallConfiguration, modFileList, localVersionFolder, da
self.remoteVersionInfo = _testRemoteSubModVersion
else:
try:
self.remoteVersionInfo = getRemoteVersion(self.targetID)
# Cache the remote version info to avoid continuously re-downloading it
if VersionManager.cachedRemoteVersionInfo is None:
self.remoteVersionInfo = getRemoteVersion(self.targetID)
VersionManager.cachedRemoteVersionInfo = self.remoteVersionInfo
else:
self.remoteVersionInfo = VersionManager.cachedRemoteVersionInfo
except Exception as error:
self.remoteVersionInfo = None
print("VersionManager: Error while retrieving remote version information {}".format(error))
Expand Down

0 comments on commit fb82b19

Please sign in to comment.