Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Allow for custom timeout in watch request #322

Merged
merged 1 commit into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kopf/clients/watching.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async def watch_objs(
# Talk to the API and initiate a streaming response.
response = await context.session.get(
url=resource.get_url(server=context.server, namespace=namespace, params=params),
timeout=aiohttp.ClientTimeout(total=None),
timeout=aiohttp.ClientTimeout(total=config.WatchersConfig.session_timeout),
)
response.raise_for_status()

Expand Down
3 changes: 3 additions & 0 deletions kopf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,6 @@ class WatchersConfig:

watcher_retry_delay: float = 0.1
""" How long should a pause be between watch requests (to prevent flooding). """

session_timeout: Optional[float] = None
""" The http session timeout to use in watch request. """