Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
Rommmmm committed Apr 1, 2024
1 parent b00697b commit 19da455
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions artifactory_cleanup/artifactorycleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ def cleanup(self, block_ctx_mgr, test_ctx_mgr) -> Iterator[CleanupSummary]:
print(f"Found {len(artifacts_to_remove)} artifacts AFTER filtering")

# Delete artifacts
def _delete_with_context(artifact, policy, test_ctx_mgr, get_name_for_ci, destroy, ignore_not_found):
def _delete(artifact):
with test_ctx_mgr(get_name_for_ci(artifact)):
return policy.delete(artifact, destroy=destroy, ignore_not_found=ignore_not_found)
policy.delete(artifact, destroy=self.destroy)

with ThreadPoolExecutor(max_workers=int(self.worker_count)) as executor:
for artifact in artifacts_to_remove:
executor.submit(
_delete_with_context, artifact, policy, test_ctx_mgr, get_name_for_ci, self.destroy, self.ignore_not_found
)
executor.submit(_delete, artifact=artifact)

# Show summary
print(f"Deleted artifacts count: {len(artifacts_to_remove)}")
Expand Down

0 comments on commit 19da455

Please sign in to comment.