mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Use the new ready line from LL dev build 1352+ (#5775)
* Revert "Wait for two 'Started Launcher' lines before connecting to managed LL (#5751)" This reverts commit cf85a6470fb17e1038f7448b9ed623ed83a424b5. * Use the new ready line from LL dev build 1352+
This commit is contained in:
parent
4daf81aa5b
commit
a32f10d758
@ -61,7 +61,6 @@ LAVALINK_DOWNLOAD_DIR: Final[pathlib.Path] = data_manager.cog_data_path(raw_name
|
|||||||
LAVALINK_JAR_FILE: Final[pathlib.Path] = LAVALINK_DOWNLOAD_DIR / "Lavalink.jar"
|
LAVALINK_JAR_FILE: Final[pathlib.Path] = LAVALINK_DOWNLOAD_DIR / "Lavalink.jar"
|
||||||
LAVALINK_APP_YML: Final[pathlib.Path] = LAVALINK_DOWNLOAD_DIR / "application.yml"
|
LAVALINK_APP_YML: Final[pathlib.Path] = LAVALINK_DOWNLOAD_DIR / "application.yml"
|
||||||
|
|
||||||
_RE_READY_LINE: Final[Pattern] = re.compile(rb"Started Launcher in \S+ seconds")
|
|
||||||
_FAILED_TO_START: Final[Pattern] = re.compile(rb"Web server failed to start\. (.*)")
|
_FAILED_TO_START: Final[Pattern] = re.compile(rb"Web server failed to start\. (.*)")
|
||||||
_RE_BUILD_LINE: Final[Pattern] = re.compile(rb"Build:\s+(?P<build>\d+)")
|
_RE_BUILD_LINE: Final[Pattern] = re.compile(rb"Build:\s+(?P<build>\d+)")
|
||||||
|
|
||||||
@ -313,22 +312,12 @@ class ServerManager:
|
|||||||
|
|
||||||
async def _wait_for_launcher(self) -> None:
|
async def _wait_for_launcher(self) -> None:
|
||||||
log.info("Waiting for Managed Lavalink node to be ready")
|
log.info("Waiting for Managed Lavalink node to be ready")
|
||||||
# Since Lavalink jar 3.4.0_1346, there are two "Started Launcher" lines logged
|
|
||||||
# before Lavalink is ready to receive requests.
|
|
||||||
started_line_seen = False
|
|
||||||
for i in itertools.cycle(range(50)):
|
for i in itertools.cycle(range(50)):
|
||||||
line = await self._proc.stdout.readline()
|
line = await self._proc.stdout.readline()
|
||||||
if _RE_READY_LINE.search(line):
|
if b"Lavalink is ready to accept connections." in line:
|
||||||
if started_line_seen:
|
|
||||||
self.ready.set()
|
self.ready.set()
|
||||||
log.info("Managed Lavalink node is ready to receive requests.")
|
log.info("Managed Lavalink node is ready to receive requests.")
|
||||||
break
|
break
|
||||||
else:
|
|
||||||
log.debug(
|
|
||||||
"Seen first 'Started Launcher' line from Managed Lavalink node."
|
|
||||||
" Waiting for the second one..."
|
|
||||||
)
|
|
||||||
started_line_seen = True
|
|
||||||
if _FAILED_TO_START.search(line):
|
if _FAILED_TO_START.search(line):
|
||||||
raise ManagedLavalinkStartFailure(
|
raise ManagedLavalinkStartFailure(
|
||||||
f"Lavalink failed to start: {line.decode().strip()}"
|
f"Lavalink failed to start: {line.decode().strip()}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user