From 4299d46b7b9c0db78497d76a50b3a889c57923bd Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Sat, 2 Mar 2024 14:17:25 +0100 Subject: [PATCH] fix: srs sync should ignore streams with only listeners, but no publishers --- source/config/tasks.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/config/tasks.py b/source/config/tasks.py index 65d8044..0b3068f 100644 --- a/source/config/tasks.py +++ b/source/config/tasks.py @@ -24,6 +24,11 @@ def scrape_srs_server(node: SRSNode): streamobjs = [] for streamjson in streams: + # if there are consumers still connected to a stream, the stream will stay listed, + # but the publish status will be false. we do not care about such (dead) streams. + active = streamjson.get('publish', {}).get('active', False) + if not active: + continue # find the corresponding stream object by comparing the stream uuid stream = Stream.objects.get(stream=streamjson.get('name')) streaminstance, _ = SRSStreamInstance.objects.get_or_create(stream=stream, node=node)