Cache downloads cleanup

This commit is contained in:
Ivan Kravets
2022-04-04 22:21:06 +03:00
parent a03d82ff1a
commit 76bea5b7a7

View File

@ -20,7 +20,7 @@ import time
import click import click
from platformio import app, compat from platformio import app, compat, util
from platformio.package.download import FileDownloader from platformio.package.download import FileDownloader
from platformio.package.lockfile import LockFile from platformio.package.lockfile import LockFile
@ -43,6 +43,7 @@ class PackageManagerDownloadMixin(object):
with app.State(self.get_download_usagedb_path(), lock=True) as state: with app.State(self.get_download_usagedb_path(), lock=True) as state:
state[os.path.basename(path)] = int(time.time() if not utime else utime) state[os.path.basename(path)] = int(time.time() if not utime else utime)
@util.memoized(DOWNLOAD_CACHE_EXPIRE)
def cleanup_expired_downloads(self): def cleanup_expired_downloads(self):
with app.State(self.get_download_usagedb_path(), lock=True) as state: with app.State(self.get_download_usagedb_path(), lock=True) as state:
# remove outdated # remove outdated