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

Improve streaming read_timeout docs (#584) #585

Open
wants to merge 1 commit into
base: master
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
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,19 @@ Docker::Event { :status => die, :id => 663005cdeb56f50177c395a817dbc8bdcfbdfbdae
# => nil
```

These methods are prone to read timeouts. `Docker.options[:read_timeout]` will need to be made higher than 60 seconds if expecting a long time between events.
These methods are prone to read timeouts. The timeout can be disabled by setting it to zero, or simply made much higher:

```ruby
# Disable timeouts completely
Docker::Event.stream({ read_timeout: 0 }) { |event| … }

# Timeout if no events are received in 24h
Docker::Event.stream({ read_timeout: 60 * 60 * 24) }) { |event| … }

# Set a high timeout globally. Be warned that you probably don't want this for other methods.
Docker.options[:read_timeout] = 60 * 60 * 24
Docker::Event.stream { |event| … }
```

## Connecting to Multiple Servers

Expand Down