From 34a179b110f63fdf99fd3c4529bb70d0d589f42e Mon Sep 17 00:00:00 2001 From: gmega Date: Mon, 27 Jan 2025 20:02:32 -0300 Subject: [PATCH] fix: check that cid is not none before removing --- benchmarks/core/experiments/static_experiment.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/benchmarks/core/experiments/static_experiment.py b/benchmarks/core/experiments/static_experiment.py index 6cde1f9..f4bf5fa 100644 --- a/benchmarks/core/experiments/static_experiment.py +++ b/benchmarks/core/experiments/static_experiment.py @@ -110,14 +110,17 @@ class StaticDisseminationExperiment( def teardown(self, exception: Optional[Exception] = None): def _remove(element: Tuple[int, Node[TNetworkHandle, TInitialMetadata]]): index, node = element - assert self._cid is not None # to please mypy + # This means this node didn't even get to seed anything. + if self._cid is None: + return element + + # Since teardown might be called as the result of an exception, it's expected + # that not all removes will succeed, so we don't check their result. node.remove(self._cid) logger.info("Node %d (%s) removed file", index + 1, node.name) return element try: - # Since teardown might be called as the result of an exception, it's expected - # that not all removes will succeed, so we don't check their result. ensure_successful( [ self._executor.submit(_remove, (i, node))