Skip to content

Commit

Permalink
Fix: Hardcoded string for the version of CRN needed to be fix
Browse files Browse the repository at this point in the history
If the fetch of the version wasn't found (Timeout, connectionError, etc ...)
There was a hardcoded string that replaced the version field. But this wasn't the best
option.

Solution: Return Optionnal[str] instead for being able to return a None value
  • Loading branch information
Antonyjin committed Jun 5, 2024
1 parent 83c576e commit d61ffbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/aleph_client/commands/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ async def fetch_crn_system(session: aiohttp.ClientSession, node: dict) -> Option
return data


async def get_crn_version(session: aiohttp.ClientSession, node: dict) -> str:
async def get_crn_version(session: aiohttp.ClientSession, node: dict) -> Optional[str]:
"""
Fetches compute node version asynchronously.
Expand All @@ -496,7 +496,7 @@ async def get_crn_version(session: aiohttp.ClientSession, node: dict) -> str:
str: Node version.
"""
url: str = node["address"]
version: str = "Can't fetch the version"
version = None

try:
async with async_timeout.timeout(3 * settings.HTTP_REQUEST_TIMEOUT + 3 * settings.HTTP_REQUEST_TIMEOUT * 0.3 * random()):
Expand Down

0 comments on commit d61ffbd

Please sign in to comment.