mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-13 08:36:41 +03:00
Cleanup
This commit is contained in:
parent
2e0c38c29e
commit
f651d1ee94
@ -378,26 +378,15 @@ class RemoteObjectDetector:
|
|||||||
if self.stop_event.is_set():
|
if self.stop_event.is_set():
|
||||||
return detections
|
return detections
|
||||||
|
|
||||||
# Drain any stale notifications from the ZMQ buffer before making a new request
|
# Drain any stale detection results from the ZMQ buffer before making a new request
|
||||||
# This prevents reading detection results from a previous request
|
# This prevents reading detection results from a previous request
|
||||||
stale_count = 0
|
# NOTE: This should never happen, but can in some rare cases
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
stale_msg = self.detector_subscriber.socket.recv_string(
|
self.detector_subscriber.socket.recv_string(flags=zmq.NOBLOCK)
|
||||||
flags=zmq.NOBLOCK
|
|
||||||
)
|
|
||||||
stale_count += 1
|
|
||||||
logger.warning(
|
|
||||||
f"{self.name}: Drained stale notification #{stale_count}: {stale_msg}"
|
|
||||||
)
|
|
||||||
except zmq.Again:
|
except zmq.Again:
|
||||||
break
|
break
|
||||||
|
|
||||||
if stale_count > 0:
|
|
||||||
logger.warning(
|
|
||||||
f"{self.name}: Drained {stale_count} stale notification(s) before new detection request"
|
|
||||||
)
|
|
||||||
|
|
||||||
# copy input to shared memory
|
# copy input to shared memory
|
||||||
self.np_shm[:] = tensor_input[:]
|
self.np_shm[:] = tensor_input[:]
|
||||||
self.detection_queue.put(self.name)
|
self.detection_queue.put(self.name)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user