Skip to content

Commit

Permalink
fix empty queue
Browse files Browse the repository at this point in the history
  • Loading branch information
mgineer85 committed Nov 26, 2024
1 parent bac7e4e commit d2cd9f6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wigglecam/services/backends/cameras/virtualcamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import random
import time
from queue import Full, Queue
from queue import Empty, Full, Queue
from threading import BrokenBarrierError, Condition, current_thread

import numpy
Expand Down Expand Up @@ -160,7 +160,12 @@ def _camera_fun(self):
while not current_thread().stopped():
# adjust_amount_clamped = 0

img, timestamp_exposure_start = self._producer_queue.get(block=True, timeout=1)
try:
img, timestamp_exposure_start = self._producer_queue.get(block=True, timeout=1)
except Empty:
# if producer did not yet produce something, because thread started delayed, we just continue
continue

self._current_timestampset.camera = timestamp_exposure_start

with self._data_condition:
Expand Down

0 comments on commit d2cd9f6

Please sign in to comment.