Skip to content

Commit 7e19faf

Browse files
Merge pull request #585 from danschmidt5189/stream-timeout-docs-584
Improve streaming read_timeout docs (#584)
2 parents 7f47e98 + c78c204 commit 7e19faf

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,19 @@ Docker::Event { :status => die, :id => 663005cdeb56f50177c395a817dbc8bdcfbdfbdae
588588
# => nil
589589
```
590590
591-
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.
591+
These methods are prone to read timeouts. The timeout can be disabled by setting it to zero, or simply made much higher:
592+
593+
```ruby
594+
# Disable timeouts completely
595+
Docker::Event.stream({ read_timeout: 0 }) { |event| … }
596+
597+
# Timeout if no events are received in 24h
598+
Docker::Event.stream({ read_timeout: 60 * 60 * 24) }) { |event| … }
599+
600+
# Set a high timeout globally. Be warned that you probably don't want this for other methods.
601+
Docker.options[:read_timeout] = 60 * 60 * 24
602+
Docker::Event.stream { |event| … }
603+
```
592604
593605
## Connecting to Multiple Servers
594606

0 commit comments

Comments
 (0)