mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
added check of unknown files in temp
This commit is contained in:
parent
8f28b96c7f
commit
2d86f0ee7c
1 changed files with 19 additions and 0 deletions
|
|
@ -142,7 +142,9 @@ class TempPublishFiles(object):
|
||||||
data = self._get_data()
|
data = self._get_data()
|
||||||
now = time.time()
|
now = time.time()
|
||||||
remove_ids = set()
|
remove_ids = set()
|
||||||
|
all_ids = set()
|
||||||
for item_id, item_data in data.items():
|
for item_id, item_data in data.items():
|
||||||
|
all_ids.add(item_id)
|
||||||
if check_expiration and now < item_data["expiration"]:
|
if check_expiration and now < item_data["expiration"]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
@ -159,6 +161,23 @@ class TempPublishFiles(object):
|
||||||
exc_info=True
|
exc_info=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Remove unknown folders/files
|
||||||
|
for filename in os.listdir(self._root_dir):
|
||||||
|
if filename in all_ids:
|
||||||
|
continue
|
||||||
|
|
||||||
|
full_path = os.path.join(self._root_dir, filename)
|
||||||
|
if full_path in (self._metadata_path, self._lock_path):
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
shutil.rmtree(full_path)
|
||||||
|
except Exception:
|
||||||
|
self.log.warning(
|
||||||
|
"Couldn't remove arbitrary path \"{}\"".format(full_path),
|
||||||
|
exc_info=True
|
||||||
|
)
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self.cleanup(False)
|
self.cleanup(False)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue