mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 03:59:17 +02:00
Merge branch 'federation-cache-cleaning' into 'develop'
Ensure cache_cleaning only targets remote files See merge request funkwhale/funkwhale!424
This commit is contained in:
commit
4d425e92ee
2 changed files with 13 additions and 3 deletions
|
@ -30,7 +30,8 @@ def clean_music_cache():
|
|||
candidates = (
|
||||
music_models.Upload.objects.filter(
|
||||
Q(audio_file__isnull=False)
|
||||
& (Q(accessed_date__lt=limit) | Q(accessed_date=None))
|
||||
& (Q(accessed_date__lt=limit) | Q(accessed_date=None)),
|
||||
# library__actor__user=None,
|
||||
)
|
||||
.local(False)
|
||||
.exclude(audio_file="")
|
||||
|
@ -56,8 +57,10 @@ def get_files(storage, *parts):
|
|||
"""
|
||||
if not parts:
|
||||
raise ValueError("Missing path")
|
||||
|
||||
dirs, files = storage.listdir(os.path.join(*parts))
|
||||
try:
|
||||
dirs, files = storage.listdir(os.path.join(*parts))
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
for dir in dirs:
|
||||
files += get_files(storage, *(list(parts) + [dir]))
|
||||
return [os.path.join(parts[-1], path) for path in files]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue