fix: srs sync should ignore streams with only listeners, but no publishers

This commit is contained in:
Jan Koppe 2024-03-02 14:17:25 +01:00
parent e2130621ad
commit 4299d46b7b
Signed by: thunfisch
GPG Key ID: BE935B0735A2129B
1 changed files with 5 additions and 0 deletions

View File

@ -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)