Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Track stuck error message and detect when a track is stuck so that it can be skipped. #5630

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion redbot/cogs/audio/core/events/lavalink.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ async def lavalink_event_handler(
colour=await self.bot.get_embed_color(message_channel),
title=_("Track Stuck"),
description=_(
"Playback of the song has stopped due to an unexpected error.\n{error}"
"Playback of the song was unable to continue.\n{error}"
).format(error=description),
)
else:
Expand Down
3 changes: 3 additions & 0 deletions redbot/cogs/audio/core/tasks/lavalink.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async def lavalink_attempt_connect(self, timeout: int = 50, manual: bool = False
await self.managed_node_controller.shutdown()
await asyncio.sleep(5)
await lavalink.close(self.bot)
is_managed = False
while retry_count < max_retries:
configs = await self.config.all()
external = configs["use_external_lavalink"]
Expand All @@ -62,6 +63,7 @@ async def lavalink_attempt_connect(self, timeout: int = 50, manual: bool = False
# timeout is the same as ServerManager.timeout -
# 60s in case of ServerManager(self.config, timeout=60)
await self.managed_node_controller.wait_until_ready()
is_managed = True
except asyncio.TimeoutError:
if self.managed_node_controller is not None:
await self.managed_node_controller.shutdown()
Expand Down Expand Up @@ -110,6 +112,7 @@ async def lavalink_attempt_connect(self, timeout: int = 50, manual: bool = False
timeout=timeout,
resume_key=f"Red-Core-Audio-{self.bot.user.id}-{data_manager.instance_name}",
secured=secured,
is_managed=is_managed,
)
except lavalink.AbortingNodeConnection:
await lavalink.close(self.bot)
Expand Down
7 changes: 5 additions & 2 deletions redbot/cogs/audio/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,11 @@ async def start_monitor(self, java_path: str):
if not psutil.pid_exists(self._node_pid):
raise NoProcessFound
try:
node = lavalink.get_all_nodes()[0]
if node.ready:
lavalink.get_all_nodes()[0]
node = next(
(node for node in lavalink.get_all_nodes() if node.is_managed), None
)
if node and node.ready:
# Hoping this throws an exception which will then trigger a restart
await node._ws.ping()
backoff = ExponentialBackoff(
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ install_requires =
pytz==2021.1
PyYAML==5.4.1
Red-Commons==1.0.0
Red-Lavalink==0.11.0rc0
Red-Lavalink @ git+https://github.com/Cog-Creators/Red-Lavalink@refs/pull/118/merge#egg=Red-Lavalink
rich==10.9.0
schema==0.7.4
six==1.16.0
Expand Down