Do not use the default timeout when streming logs #908
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What do these changes do?
This update modifies the default session timeout in the
aiohttp
client when callingDockerContainer.log()
. Currently, the default timeout appears to be 300 seconds. By explicitly setting aClientTimeout
withsock_read=None
, the logs can continue streaming as long as the connection remains active. This seems like a more suitable default behavior for continuous log streaming.Are there changes in behavior for the user?
There may be a small impact for users who have implemented workarounds to handle the current 5-minute timeout, as they might expect the connection to terminate after that period. However, the overall effect should be minimal.
For better backward compatibility, an alternative approach could be to introduce a
timeout_seconds
parameter in theDockerContainer.log()
function, defaulting to 300 seconds.Related issue number
This issue was originally discussed in #901, and the solution was proposed by @toerb. I have adapted this approach and successfully tested it in my own projects.
Checklist