From e3d4fdcdae28f1ba06b23910db8a62bfcef68dea Mon Sep 17 00:00:00 2001 From: marcsello Date: Thu, 18 Nov 2021 18:15:03 +0100 Subject: [PATCH] Added queue tracking --- birbnetes_iot_platform_raspberry/record_stuff.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/birbnetes_iot_platform_raspberry/record_stuff.py b/birbnetes_iot_platform_raspberry/record_stuff.py index 58aa5ef..496596b 100644 --- a/birbnetes_iot_platform_raspberry/record_stuff.py +++ b/birbnetes_iot_platform_raspberry/record_stuff.py @@ -88,6 +88,9 @@ class SlicedRecorder(Thread): except Empty: return None + def get_queue_length(self) -> int: + return self._output_queue.qsize() + def stop(self): self._active = False @@ -104,6 +107,10 @@ class BirbnetesIoTPlatformRecordDriver: def get_recording(cls, blocking: bool = False) -> Optional[str]: return cls.sliced_recorder.get_recording(blocking) + @classmethod + def get_queue_length(cls) -> int: + return cls.sliced_recorder.get_queue_length() + @classmethod def cleanup(cls): cls.sliced_recorder.stop()