Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use the default timeout when streaming logs #908

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
13 changes: 9 additions & 4 deletions aiodocker/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
overload,
)

from aiohttp import ClientResponse, ClientWebSocketResponse
from aiohttp import ClientResponse, ClientTimeout, ClientWebSocketResponse
from multidict import MultiDict
from yarl import URL

Expand Down Expand Up @@ -182,16 +182,21 @@ def log(
stdout: bool = False,
stderr: bool = False,
follow: bool = False,
timeout: Optional[ClientTimeout] = None,
**kwargs,
) -> Any:
if stdout is False and stderr is False:
raise TypeError("Need one of stdout or stderr")

params = {"stdout": stdout, "stderr": stderr, "follow": follow}
params.update(kwargs)
cm = self.docker._query(
f"containers/{self._id}/logs", method="GET", params=params
)

query_args = {"method": "GET", "params": params}
if isinstance(timeout, ClientTimeout):
query_args["timeout"] = timeout

cm = self.docker._query(f"containers/{self._id}/logs", **query_args)

if follow:
return self._logs_stream(cm)
else:
Expand Down
Loading