Skip to content

Commit

Permalink
Wait for all the images in the queue to be indexed before server shut…
Browse files Browse the repository at this point in the history
…down
  • Loading branch information
hv0905 committed Jul 6, 2024
1 parent 308b38c commit 4f3e913
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/Services/upload_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,9 @@ async def sync_upload_image(self, img_data: ImageData, img_bytes: bytes, skip_oc

def get_queue_size(self):
return self._queue.qsize()

async def on_exit(self): # pragma: no cover Hard to test in UT.
if self.get_queue_size() != 0:
logger.warning("There are still {} images in the upload queue. Waiting for upload process to be completed.",
self.get_queue_size())
await self._queue.join()

0 comments on commit 4f3e913

Please sign in to comment.