Skip to content

Commit 8fb26f4

Browse files
authored
docs: add clarifications to read timeout (#873)
Clarify timeout definition and usage, especially on read timeout - read timeout is the number of seconds the client will wait for the server to send a response. In most cases, this is the maximum wait time before the server sends the first byte. - connect timeout is the number of seconds to establish a connection to the server Fixes internal b/238779055
1 parent d1df440 commit 8fb26f4

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

docs/storage/retry_timeout.rst

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,27 @@ Configuring Timeouts
1212
--------------------
1313

1414
For a number of reasons, methods which invoke API methods may take
15-
longer than expected or desired. By default, such methods all time out
16-
after a default interval, 60.0 seconds. Rather than blocking your application
17-
code for that interval, you may choose to configure explicit timeouts
18-
in your code, using one of three forms:
15+
longer than expected or desired. By default, such methods are applied a
16+
default timeout of 60.0 seconds.
1917

20-
- You can pass a single integer or float which functions as the timeout for the
21-
entire request. E.g.:
18+
The python-storage client uses the timeout mechanics of the underlying
19+
``requests`` HTTP library. The connect timeout is the number of seconds
20+
to establish a connection to the server. The read timeout is the number
21+
of seconds the client will wait for the server to send a response.
22+
In most cases, this is the maximum wait time before the server sends
23+
the first byte. Please refer to the `requests documentation <https://requests.readthedocs.io/en/latest/user/advanced/#timeouts>`_ for details.
24+
25+
You may also choose to configure explicit timeouts in your code, using one of three forms:
26+
27+
- You can specify a single value for the timeout. The timeout value will be
28+
applied to both the connect and the read timeouts. E.g.:
2229

2330
.. code-block:: python
2431
2532
bucket = client.get_bucket(BUCKET_NAME, timeout=300.0) # five minutes
2633
27-
- You can also be passed as a two-tuple, ``(connect_timeout, read_timeout)``,
28-
where the ``connect_timeout`` sets the maximum time required to establish
29-
the connection to the server, and the ``read_timeout`` sets the maximum
30-
time to wait for a completed response. E.g.:
34+
- You can also pass a two-tuple, ``(connect_timeout, read_timeout)``,
35+
if you would like to set the values separately. E.g.:
3136

3237
.. code-block:: python
3338

0 commit comments

Comments
 (0)