fix: Cleanup prints, improve archiver.

pull/640/head
Raphaël Vinot 2023-03-16 12:28:28 +01:00
parent 8978f1b798
commit 9497060028
3 changed files with 5 additions and 7 deletions

View File

@ -122,6 +122,7 @@ class Archiver(AbstractManager):
for capture_path in captures:
p.delete(str(capture_path))
(capture_path / 'tree.pickle').unlink(missing_ok=True)
(capture_path / 'tree.pickle.gz').unlink(missing_ok=True)
capture_path.rename(dest_dir / capture_path.name)
p.execute()

View File

@ -99,7 +99,6 @@ def load_pickle_tree(capture_dir: Path, last_mod_time: int) -> CrawledTree:
with gzip.open(pickle_file_gz, 'rb') as _pg:
tree = pickle.load(_pg)
except pickle.UnpicklingError as e:
print(e)
remove_pickle_tree(capture_dir)
if tree:
@ -110,10 +109,8 @@ def load_pickle_tree(capture_dir: Path, last_mod_time: int) -> CrawledTree:
# The capture was moved.
remove_pickle_tree(capture_dir)
except EOFError as e:
print(e)
remove_pickle_tree(capture_dir)
except Exception as e:
print(e)
remove_pickle_tree(capture_dir)
if list(capture_dir.rglob('*.har')) or list(capture_dir.rglob('*.har.gz')):

8
poetry.lock generated
View File

@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry and should not be changed by hand.
# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand.
[[package]]
name = "aiohttp"
@ -648,14 +648,14 @@ tests = ["asttokens", "littleutils", "pytest", "rich"]
[[package]]
name = "filelock"
version = "3.9.1"
version = "3.10.0"
description = "A platform independent file lock."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "filelock-3.9.1-py3-none-any.whl", hash = "sha256:4427cdda14a1c68e264845142842d6de2d0fa2c15ba31571a3d9c9a1ec9d191c"},
{file = "filelock-3.9.1.tar.gz", hash = "sha256:e393782f76abea324dee598d2ea145b857a20df0e0ee4f80fcf35e72a341d2c7"},
{file = "filelock-3.10.0-py3-none-any.whl", hash = "sha256:e90b34656470756edf8b19656785c5fea73afa1953f3e1b0d645cef11cab3182"},
{file = "filelock-3.10.0.tar.gz", hash = "sha256:3199fd0d3faea8b911be52b663dfccceb84c95949dd13179aa21436d1a79c4ce"},
]
[package.extras]