Skip to content

Commit

Permalink
fix: [crawler] fix undefined capture status
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed May 25, 2023
1 parent 9a4feb9 commit 405d097
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bin/lib/crawlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,10 @@ def get_start_time(self):
return self.get_task().get_start_time()

def get_status(self):
return r_cache.hget(f'crawler:capture:{self.uuid}', 'status')
status = r_cache.hget(f'crawler:capture:{self.uuid}', 'status')
if not status:
status = -1
return status

def is_ongoing(self):
return self.get_status() == CaptureStatus.ONGOING
Expand All @@ -1109,7 +1112,7 @@ def create(self, task_uuid):
def update(self, status):
# Error or Reload
if not status:
r_cache.hset(f'crawler:capture:{self.uuid}', 'status', CaptureStatus.UNKNOWN)
r_cache.hset(f'crawler:capture:{self.uuid}', 'status', CaptureStatus.UNKNOWN.value)
r_cache.zadd('crawler:captures', {self.uuid: 0})
else:
last_check = int(time.time())
Expand Down

0 comments on commit 405d097

Please sign in to comment.