Skip to content

Commit 1d1fcfa

Browse files
add documentation for the server & client side timeout
Signed-off-by: Priyanka Saggu <[email protected]>
1 parent a126ab0 commit 1d1fcfa

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Diff for: examples/pod_namespace_watch.py

+19
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,25 @@ def main():
3131
v1 = client.CoreV1Api()
3232
count = 10
3333
w = watch.Watch()
34+
"""
35+
[INFO: `server-side` & `client-side` timeout]
36+
37+
`kwargs['timeout_seconds'] = n`:
38+
- It is a server-side timeout, i.e. a polite request to the server,
39+
mentioning it to cleanly close the connection after n seconds.
40+
- If the user have a network outage, then this parameter will do nothing.
41+
- The client will hang indefinitely without raising an exception.
42+
- You can set this number much higher, maybe to 3600 seconds (1h).
43+
44+
`kwargs['_request_timeout'] = n`:
45+
- It is a client-side timeout, configuring the user's local socket.
46+
- If the user have a network outage, resulting into dropping all packets
47+
with no RST/FIN, the value of n will specify, for how long
48+
the client would wait before realizing the network outage,
49+
& dropping the connection.
50+
- The connection will drop, followed by raising an exception.
51+
- You can keep this number low.
52+
"""
3453
for event in w.stream(v1.list_namespace, timeout_seconds=10):
3554
print("Event: %s %s" % (event['type'], event['object'].metadata.name))
3655
count -= 1

0 commit comments

Comments
 (0)