Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eventhub] websocket default timeout fix #24565

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def set_cloexec(fd, cloexec): # noqa
AMQP_FRAME = memoryview(b'AMQP')
EMPTY_BUFFER = bytes()
SIGNED_INT_MAX = 0x7FFFFFFF
WEBSOCKET_TIMEOUT = 1

# Match things like: [fe80::1]:5432, from RFC 2732
IPV6_LITERAL = re.compile(r'\[([\.0-9a-f:]+)\](?::(\d+))?')
Expand Down Expand Up @@ -658,9 +659,9 @@ def Transport(host, transport_type, connect_timeout=None, ssl=False, **kwargs):
return transport(host, connect_timeout=connect_timeout, ssl=ssl, **kwargs)

class WebSocketTransport(_AbstractTransport):
def __init__(self, host, port=WEBSOCKET_PORT, connect_timeout=1, ssl=None, **kwargs):
def __init__(self, host, port=WEBSOCKET_PORT, connect_timeout=None, ssl=None, **kwargs):
self.sslopts = ssl if isinstance(ssl, dict) else {}
self._connect_timeout = connect_timeout
self._connect_timeout = connect_timeout or WEBSOCKET_TIMEOUT
self._host = host
super().__init__(
host, port, connect_timeout, **kwargs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
_UNAVAIL,
set_cloexec,
AMQP_PORT,
WEBSOCKET_TIMEOUT,
WebSocketTransport
)

Expand Down Expand Up @@ -418,13 +419,13 @@ async def negotiate(self):


class WebSocketTransportAsync(AsyncTransportMixin):
def __init__(self, host, port=WEBSOCKET_PORT, connect_timeout=1, ssl=None, **kwargs
def __init__(self, host, port=WEBSOCKET_PORT, connect_timeout=None, ssl=None, **kwargs
):
self._read_buffer = BytesIO()
self.loop = get_running_loop()
self.socket_lock = asyncio.Lock()
self.sslopts = ssl if isinstance(ssl, dict) else {}
self._connect_timeout = connect_timeout
self._connect_timeout = connect_timeout or WEBSOCKET_TIMEOUT
self.host = host
self.ws = None
self._http_proxy = kwargs.get('http_proxy', None)
Expand Down