MCPcopy Create free account
hub / github.com/celery/celery / default_socket_timeout

Function default_socket_timeout

celery/utils/threads.py:37–49  ·  view source on GitHub ↗

Context temporarily setting the default socket timeout. Note: Only affects sockets created afterwards. To bound a connection that is already open, use :func:`bound_open_broker_sockets`.

(timeout)

Source from the content-addressed store, hash-verified

35
36@contextmanager
37def default_socket_timeout(timeout):
38 """Context temporarily setting the default socket timeout.
39
40 Note:
41 Only affects sockets created afterwards. To bound a connection
42 that is already open, use :func:`bound_open_broker_sockets`.
43 """
44 prev = socket.getdefaulttimeout()
45 socket.setdefaulttimeout(timeout)
46 try:
47 yield
48 finally:
49 socket.setdefaulttimeout(prev)
50
51
52def _open_broker_sockets(connection):

Calls

no outgoing calls