Skip to content

Commit

Permalink
Guard against none soft timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Nov 15, 2024
1 parent 81a9e56 commit 4b9b837
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions librarian_background/rolling_deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4b9b837

Please sign in to comment.