mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
fix: [crawler] fix undefined capture status
This commit is contained in:
parent
9a4feb93a0
commit
405d097024
1 changed files with 5 additions and 2 deletions
|
@ -1091,7 +1091,10 @@ class CrawlerCapture:
|
|||
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
|
||||
|
@ -1109,7 +1112,7 @@ class CrawlerCapture:
|
|||
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())
|
||||
|
|
Loading…
Reference in a new issue