Added None guards to satisfy mypy strict union-attr checks.
This commit is contained in:
@@ -188,6 +188,8 @@ class CommandHandler:
|
|||||||
for domain in subscribed_domains:
|
for domain in subscribed_domains:
|
||||||
# Get the stream state from the database
|
# Get the stream state from the database
|
||||||
stream_state = await self.stream_repo.get_by_domain(domain)
|
stream_state = await self.stream_repo.get_by_domain(domain)
|
||||||
|
if stream_state is None:
|
||||||
|
continue
|
||||||
|
|
||||||
# Determine stream name (use domain as fallback)
|
# Determine stream name (use domain as fallback)
|
||||||
stream_name = stream_state.name if stream_state.name else domain
|
stream_name = stream_state.name if stream_state.name else domain
|
||||||
@@ -204,6 +206,7 @@ class CommandHandler:
|
|||||||
# Determine status and duration (as a sub-bullet)
|
# Determine status and duration (as a sub-bullet)
|
||||||
if stream_state.status == StreamStatus.ONLINE:
|
if stream_state.status == StreamStatus.ONLINE:
|
||||||
# Stream is online - use last_connect_time
|
# Stream is online - use last_connect_time
|
||||||
|
if stream_state.last_connect_time:
|
||||||
duration = self._format_duration(stream_state.last_connect_time)
|
duration = self._format_duration(stream_state.last_connect_time)
|
||||||
body_text += f" - Status: Online for {duration} \n"
|
body_text += f" - Status: Online for {duration} \n"
|
||||||
elif stream_state.status == StreamStatus.UNKNOWN:
|
elif stream_state.status == StreamStatus.UNKNOWN:
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ class StreamMonitor:
|
|||||||
old_state = await self.stream_repo.get_by_domain(domain)
|
old_state = await self.stream_repo.get_by_domain(domain)
|
||||||
failure_counter = old_state.failure_counter if old_state else 0
|
failure_counter = old_state.failure_counter if old_state else 0
|
||||||
|
|
||||||
|
if old_state is None:
|
||||||
|
return True
|
||||||
|
|
||||||
# Check if we should query this stream based on backoff schedule
|
# Check if we should query this stream based on backoff schedule
|
||||||
if not should_query_stream(failure_counter):
|
if not should_query_stream(failure_counter):
|
||||||
# Skip this cycle, increment counter to track time passage
|
# Skip this cycle, increment counter to track time passage
|
||||||
|
|||||||
Reference in New Issue
Block a user