From 4c92bdd11cb0db4d508a77eaf439527d743d58cc Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 24 Feb 2024 21:36:08 +0100 Subject: [PATCH] FIX: Handle `stop_streaming` exceptions in the main loop of the camera plugin. Otherwise camera process teardown errors may bubble up and prevent the plugin from restarting the streaming. --- platypush/plugins/camera/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/camera/__init__.py b/platypush/plugins/camera/__init__.py index 2ee347da7..f9a50edf8 100644 --- a/platypush/plugins/camera/__init__.py +++ b/platypush/plugins/camera/__init__.py @@ -1035,7 +1035,13 @@ class CameraPlugin(RunnablePlugin, ABC): camera = cameras[0] wait_for_either(self._should_stop, camera.stop_stream_event) - self.stop_streaming() + + try: + self.stop_streaming() + except Exception as e: + self.logger.warning('Error while stopping the camera stream: %s', e) + finally: + self.wait_stop(timeout=2) # vim:sw=4:ts=4:et: