fix: Properly unset async capture when the queue is empty

pull/526/head
Raphaël Vinot 2022-09-23 21:40:56 +02:00
parent 354841b005
commit 2ec55be573
1 changed files with 3 additions and 0 deletions

View File

@ -66,6 +66,7 @@ class AsyncCapture(AbstractManager):
uuid = await self.lacus.consume_queue() uuid = await self.lacus.consume_queue()
if not uuid: if not uuid:
# Nothing to capture right now. # Nothing to capture right now.
self.unset_running()
return return
# Capture is done, doing lookyloo post processing now. # Capture is done, doing lookyloo post processing now.
entries = self.lacus.get_capture(uuid, decode=True) entries = self.lacus.get_capture(uuid, decode=True)
@ -73,6 +74,7 @@ class AsyncCapture(AbstractManager):
self.logger.warning(f'The capture {uuid} is reported as not done ({entries["status"]}) when it should.') self.logger.warning(f'The capture {uuid} is reported as not done ({entries["status"]}) when it should.')
self.redis.zrem('to_capture', uuid) self.redis.zrem('to_capture', uuid)
self.redis.delete(uuid) self.redis.delete(uuid)
self.unset_running()
return return
else: else:
# Find a capture that is done # Find a capture that is done
@ -85,6 +87,7 @@ class AsyncCapture(AbstractManager):
break break
else: else:
# Nothing to capture right now. # Nothing to capture right now.
self.unset_running()
return return
self.redis.sadd('ongoing', uuid) self.redis.sadd('ongoing', uuid)