Skip to content

Commit

Permalink
Cleaned up error and debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Arne-Weber authored and Windows200000 committed Aug 27, 2024
1 parent 74de204 commit 9c2ec99
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
4 changes: 1 addition & 3 deletions channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ async def send_watch(self) -> tuple[bool, bool]:
except RequestException:
logger.error(f"Failed to recieve list of m3u8 playlists.")
return False, False
logger.log(CALL,f"BroadcastQualities: {BroadcastQualitiesM3U}")

BroadcastQualitiesM3U = BroadcastQualitiesM3U.split("\n")
BroadcastQualitiesList = []
Expand All @@ -412,7 +411,6 @@ async def send_watch(self) -> tuple[bool, bool]:
if not all(validators.url(url) for url in BroadcastQualitiesList):
logger.error(f"Couldn't parse list of m3u8 playlists.")
return False, False
logger.log(CALL,f"BroadcastQualitiesList: {BroadcastQualitiesList}")

retries = -1
for BroadcastQuality in BroadcastQualitiesList:
Expand Down Expand Up @@ -448,7 +446,7 @@ async def send_watch(self) -> tuple[bool, bool]:
logger.error(f"Failed to recieve list of streams.")
return False, False
await asyncio.sleep(1) # Wait a second to not spam twitch API
logger.error(f"Failed to watch all of {len(BroadcastQualitiesList)} Broadcast qualities. Can be ignored if occuring ~15x/hour.")
logger.error(f"Failed to watch all of {len(BroadcastQualitiesList)} Broadcast qualities. Can be ignored if occuring up to ~15x/hour.")
return False, True
"""
End of fix for 2024/5 API Change.
Expand Down
3 changes: 0 additions & 3 deletions twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,9 +1045,7 @@ async def _watch_sleep(self, delay: float) -> None:
async def _watch_loop(self) -> NoReturn:
interval: float = WATCH_INTERVAL.total_seconds()
while True:
logger.log(CALL,f"beginning of watch loop")
channel: Channel = await self.watching_channel.get()
logger.log(CALL,f"about to send watch")
succeeded, repeat_now = await channel.send_watch()
logger.log(CALL,f"returned watch, succeeded: {succeeded}, repeat_new: {repeat_now}")
if not succeeded:
Expand All @@ -1056,7 +1054,6 @@ async def _watch_loop(self) -> NoReturn:
# NOTE: the maintenance task should switch the channel right after this happens
if not repeat_now:
await self._watch_sleep(interval)
logger.log(CALL,f"send_watch returned false")
continue
last_watch = time()
self._drop_update = asyncio.Future()
Expand Down

0 comments on commit 9c2ec99

Please sign in to comment.