1 parent
44b085abf6
commit
462d281a61
11 files changed
+16
-16
No files matched your search
@@ -861,7 +861,7 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
|
||||
if isinstance(result, list):
|
||||
return result
|
||||
|
||||
def fetch_blacklist_from_url(url, timeout=3, cache=None):
|
||||
def fetch_blacklist_from_url(url, timeout=3.05, cache=None):
|
||||
result = []
|
||||
try:
|
||||
r = requests.get(url, timeout=timeout)
|
||||
|
||||
@@ -488,7 +488,7 @@ class AnnouncementPlugin(
|
||||
url = config["url"]
|
||||
try:
|
||||
start = time.monotonic()
|
||||
r = requests.get(url, timeout=30)
|
||||
r = requests.get(url, timeout=3.05)
|
||||
r.raise_for_status()
|
||||
self._logger.info(
|
||||
"Loaded channel {} from {} in {:.2}s".format(
|
||||
|
||||
@@ -840,7 +840,7 @@ class BackupPlugin(
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
r = requests.get(url, timeout=30)
|
||||
r = requests.get(url, timeout=3.05)
|
||||
r.raise_for_status()
|
||||
except Exception:
|
||||
logger.exception(
|
||||
|
||||
@@ -1990,7 +1990,7 @@ class PluginManagerPlugin(
|
||||
|
||||
repository_url = self._settings.get(["repository"])
|
||||
try:
|
||||
r = requests.get(repository_url, timeout=30)
|
||||
r = requests.get(repository_url, timeout=3.05)
|
||||
r.raise_for_status()
|
||||
self._logger.info(f"Loaded plugin repository data from {repository_url}")
|
||||
except Exception as e:
|
||||
@@ -2080,7 +2080,7 @@ class PluginManagerPlugin(
|
||||
|
||||
notices_url = self._settings.get(["notices"])
|
||||
try:
|
||||
r = requests.get(notices_url, timeout=30)
|
||||
r = requests.get(notices_url, timeout=3.05)
|
||||
r.raise_for_status()
|
||||
self._logger.info(f"Loaded plugin notices data from {notices_url}")
|
||||
except Exception as e:
|
||||
|
||||
@@ -424,7 +424,7 @@ class SoftwareUpdatePlugin(
|
||||
def _get_check_overlay(self, url):
|
||||
self._logger.info(f"Fetching check overlays from {url}")
|
||||
try:
|
||||
r = requests.get(url, timeout=3.1)
|
||||
r = requests.get(url, timeout=3.05)
|
||||
r.raise_for_status()
|
||||
data = r.json()
|
||||
except Exception as exc:
|
||||
@@ -1148,7 +1148,7 @@ class SoftwareUpdatePlugin(
|
||||
)
|
||||
|
||||
def view():
|
||||
self._environment_ready.wait(timeout=30.0)
|
||||
self._environment_ready.wait(timeout=10.0)
|
||||
|
||||
try:
|
||||
(
|
||||
|
||||
@@ -49,7 +49,7 @@ def _get_latest_commit(user, repo, branch, api_user=None, api_password=None):
|
||||
headers["authorization"] = f"Basic {auth_value}"
|
||||
|
||||
try:
|
||||
r = requests.get(url, headers=headers, timeout=(3.05, 30))
|
||||
r = requests.get(url, headers=headers, timeout=(3.05, 7))
|
||||
except requests.ConnectionError as exc:
|
||||
raise NetworkError(cause=exc)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ def get_latest(target, check, online=True, *args, **kwargs):
|
||||
raise ConfigurationInvalid("jsondata version check needs jsondata set")
|
||||
|
||||
try:
|
||||
with requests.get(url, timeout=(3.05, 30)) as r:
|
||||
with requests.get(url, timeout=(3.05, 7)) as r:
|
||||
data = r.json()
|
||||
except Exception as exc:
|
||||
raise NetworkError(cause=exc)
|
||||
|
||||
@@ -67,7 +67,7 @@ def _get_latest_release(package, include_prerelease):
|
||||
from ..exceptions import NetworkError
|
||||
|
||||
try:
|
||||
r = requests.get(INFO_URL.format(package=package), timeout=(3.05, 30))
|
||||
r = requests.get(INFO_URL.format(package=package), timeout=(3.05, 7))
|
||||
except requests.ConnectionError as exc:
|
||||
raise NetworkError(cause=exc)
|
||||
|
||||
|
||||
@@ -518,9 +518,9 @@ class TrackingPlugin(
|
||||
params = urlencode(kwargs, doseq=True).replace("+", "%20")
|
||||
|
||||
if body:
|
||||
requests.post(url, data=params, timeout=3.1, headers=headers)
|
||||
requests.post(url, data=params, timeout=3.05, headers=headers)
|
||||
else:
|
||||
requests.get(url, params=params, timeout=3.1, headers=headers)
|
||||
requests.get(url, params=params, timeout=3.05, headers=headers)
|
||||
|
||||
self._logger.info(f"Sent tracking event {event}, payload: {kwargs!r}")
|
||||
except Exception:
|
||||
|
||||
@@ -102,8 +102,8 @@ class PluginBlacklistConfig(BaseModel):
|
||||
ttl: int = CONST_15MIN
|
||||
"""Time to live of the cached blacklist, in seconds (default: 15 minutes)."""
|
||||
|
||||
timeout: float = 3.1
|
||||
"""Timeout for fetching the blacklist, in seconds (default: 3.1 seconds)."""
|
||||
timeout: float = 3.05
|
||||
"""Timeout for fetching the blacklist, in seconds (default: 3.05 seconds)."""
|
||||
|
||||
|
||||
@with_attrs_docs
|
||||
|
||||
@@ -257,8 +257,8 @@ def resolve_host(host):
|
||||
return []
|
||||
|
||||
|
||||
def download_file(url, folder, max_length=None):
|
||||
with requests.get(url, stream=True, timeout=(3.05, 30)) as r:
|
||||
def download_file(url, folder, max_length=None, connect_timeout=3.05, read_timeout=7):
|
||||
with requests.get(url, stream=True, timeout=(connect_timeout, read_timeout)) as r:
|
||||
r.raise_for_status()
|
||||
|
||||
filename = None
|
||||
|
||||
Reference in new issue
Block a user