Enable socket keepalives
Connections from airflow-worker can be long-lived (e.g. when applying large Armada manifests), and are prone to disconnection due to network inactivity. This change enables socket keepalives in the default HTTP connection socket options for urllib3. Modules that use urllib3 (e.g. requests) will be affected by this change. Change-Id: I067a5edbbdff06f45394e772ebb16d5012987b6c
This commit is contained in:
parent
034b906dd6
commit
5217c645d2
|
@ -0,0 +1,9 @@
|
|||
import socket
|
||||
|
||||
import urllib3
|
||||
|
||||
if (socket.SOL_SOCKET, socket.SO_KEEPALIVE,
|
||||
1) not in urllib3.connection.HTTPConnection.default_socket_options:
|
||||
urllib3.connection.HTTPConnection.default_socket_options += [
|
||||
(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||
]
|
Loading…
Reference in New Issue