Use `0` instead of `None` when the speedtest fails. (#2650)

This commit is contained in:
Suica 2024-08-28 17:57:21 +08:00 committed by GitHub
parent 0fc9d6f4f4
commit 0601708a02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -47,13 +47,13 @@ class MirrorStatusEntryV3(pydantic.BaseModel):
debug(f" speed: {self._speed} ({int(self._speed / 1024 / 1024 * 100) / 100}MiB/s)")
except http.client.IncompleteRead:
debug(f" speed: <undetermined>")
self._speed = None
self._speed = 0
except urllib.error.URLError as error:
debug(f" speed: <undetermined> ({error})")
self._speed = None
self._speed = 0
except Exception as error:
debug(f" speed: <undetermined> ({error})")
self._speed = None
self._speed = 0
return self._speed
@ -100,4 +100,4 @@ class MirrorStatusListV3(pydantic.BaseModel):
if data.get('version') == 3:
return data
raise ValueError(f"MirrorStatusListV3 only accepts version 3 data from https://archlinux.org/mirrors/status/json/")
raise ValueError(f"MirrorStatusListV3 only accepts version 3 data from https://archlinux.org/mirrors/status/json/")