mirror of https://github.com/CIRCL/AIL-framework
fix: [crawler] fix undefined capture status
parent
9a4feb93a0
commit
405d097024
|
@ -1091,7 +1091,10 @@ class CrawlerCapture:
|
||||||
return self.get_task().get_start_time()
|
return self.get_task().get_start_time()
|
||||||
|
|
||||||
def get_status(self):
|
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):
|
def is_ongoing(self):
|
||||||
return self.get_status() == CaptureStatus.ONGOING
|
return self.get_status() == CaptureStatus.ONGOING
|
||||||
|
@ -1109,7 +1112,7 @@ class CrawlerCapture:
|
||||||
def update(self, status):
|
def update(self, status):
|
||||||
# Error or Reload
|
# Error or Reload
|
||||||
if not status:
|
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})
|
r_cache.zadd('crawler:captures', {self.uuid: 0})
|
||||||
else:
|
else:
|
||||||
last_check = int(time.time())
|
last_check = int(time.time())
|
||||||
|
|
Loading…
Reference in New Issue