From 4b9b837a4195b6286d375fc10c7bb54075481ffb Mon Sep 17 00:00:00 2001 From: Josh Borrow Date: Fri, 15 Nov 2024 11:56:12 -0500 Subject: [PATCH] Guard against none soft timeout --- librarian_background/rolling_deletion.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/librarian_background/rolling_deletion.py b/librarian_background/rolling_deletion.py index b9460ab..3983171 100644 --- a/librarian_background/rolling_deletion.py +++ b/librarian_background/rolling_deletion.py @@ -96,14 +96,15 @@ def core(self, session: Session): deleted = 0 for instance in instances: # First, see if we've timed out. - if (datetime.now(timezone.utc) - core_begin) > self.soft_timeout: - logger.warning( - "Ran out of time in deletion task! Only successfully deleted " - "{n}/{m} instances; we will return later", - n=deleted, - m=len(instances), - ) - return False + if self.soft_timeout is not None: + if (datetime.now(timezone.utc) - core_begin) > self.soft_timeout: + logger.warning( + "Ran out of time in deletion task! Only successfully deleted " + "{n}/{m} instances; we will return later", + n=deleted, + m=len(instances), + ) + return False # Check that we got what we wanted. try: