@@ -176,14 +176,15 @@ async def _on_ready():
176176 if bot .intents .members : # Lets avoid 0 Unique Users
177177 table_counts .add_row ("Unique Users" , str (users ))
178178
179- outdated_red_message = ""
180- rich_outdated_message = ""
181- pypi_version , py_version_req = await fetch_latest_red_version_info ()
182- outdated = pypi_version and pypi_version > red_version_info
183- if outdated :
184- outdated_red_message , rich_outdated_message = get_outdated_red_messages (
185- pypi_version , py_version_req
186- )
179+ fetch_version_task = asyncio .create_task (fetch_latest_red_version_info ())
180+ log .info ("Fetching information about latest Red version..." )
181+ try :
182+ await asyncio .wait_for (asyncio .shield (fetch_version_task ), timeout = 5 )
183+ except asyncio .TimeoutError :
184+ log .info ("Version information will continue to be fetched in the background..." )
185+ except Exception :
186+ # these will be logged later
187+ pass
187188
188189 rich_console = rich .get_console ()
189190 rich_console .print (INTRO , style = "red" , markup = False , highlight = False )
@@ -209,12 +210,23 @@ async def _on_ready():
209210 rich_console .print (
210211 f"Looking for a quick guide on setting up Red? Checkout { Text ('https://start.discord.red' , style = 'link https://start.discord.red}' )} "
211212 )
212- if rich_outdated_message :
213- rich_console .print (rich_outdated_message )
214213
215214 bot ._red_ready .set ()
216- if outdated_red_message :
217- await send_to_owners_with_prefix_replaced (bot , outdated_red_message )
215+
216+ try :
217+ pypi_version , py_version_req = await fetch_version_task
218+ except (aiohttp .ClientError , asyncio .TimeoutError ) as exc :
219+ log .error ("Failed to fetch latest version information from PyPI." , exc_info = exc )
220+ except (KeyError , ValueError ) as exc :
221+ log .error ("Failed to parse version metadata received from PyPI." , exc_info = exc )
222+ else :
223+ outdated = pypi_version and pypi_version > red_version_info
224+ if outdated :
225+ outdated_red_message , rich_outdated_message = get_outdated_red_messages (
226+ pypi_version , py_version_req
227+ )
228+ rich_console .print (rich_outdated_message )
229+ await send_to_owners_with_prefix_replaced (bot , outdated_red_message )
218230
219231 @bot .event
220232 async def on_command_completion (ctx : commands .Context ):
0 commit comments