Skip to content

Commit

Permalink
check that status.lastUpdatedTime is set before attempting to subtrac…
Browse files Browse the repository at this point in the history
…t! (#1754)

Don't subtract none value!
  • Loading branch information
ikreymer authored Apr 30, 2024
1 parent 270e056 commit 375057a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions backend/btrixcloud/operator/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,10 +1145,12 @@ async def is_crawl_stopping(

# check timeout if timeout time exceeds elapsed time
if crawl.timeout:
elapsed = (
status.elapsedCrawlTime
+ (dt_now() - from_k8s_date(status.lastUpdatedTime)).total_seconds()
)
elapsed = status.elapsedCrawlTime
if status.lastUpdatedTime:
elapsed += (
dt_now() - from_k8s_date(status.lastUpdatedTime)
).total_seconds()

if elapsed > crawl.timeout:
print(
f"Graceful Stop: Crawl running time exceeded {crawl.timeout} second timeout"
Expand Down

0 comments on commit 375057a

Please sign in to comment.