Skip to content

Commit

Permalink
Apply networking timeout to aiohttp session globally
Browse files Browse the repository at this point in the history
Closes: #377
Signed-off-by: Vasyl Saienko <[email protected]>
  • Loading branch information
jumpojoy committed Jan 16, 2025
1 parent 7f50469 commit 150c7d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kopf/_cogs/clients/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from kopf._cogs.clients import errors
from kopf._cogs.helpers import versions
from kopf._cogs.configs import configuration
from kopf._cogs.structs import credentials

# Per-operator storage and exchange point for authentication methods.
Expand Down Expand Up @@ -101,6 +102,8 @@ def __init__(
certificate_path: Optional[str]
private_key_path: Optional[str]

settings = configuration.OperatorSettings()

if info.ca_path and info.ca_data:
raise credentials.LoginError("Both CA path & data are set. Need only one.")
elif info.ca_path:
Expand Down Expand Up @@ -172,6 +175,11 @@ def __init__(
),
headers=headers,
auth=auth,
timeout=aiohttp.ClientTimeout(
total=settings.networking.request_timeout,
sock_connect=settings.networking.connect_timeout,
),

)

# Add the extra payload information. We avoid overriding the constructor.
Expand Down

0 comments on commit 150c7d8

Please sign in to comment.