Skip to content

Commit

Permalink
Merge pull request #115 from livechat/Fixup_related_to_timeout_in_htt…
Browse files Browse the repository at this point in the history
…p_and_ws

Changed timeout for HTTP as well as WSS
  • Loading branch information
marcindebski authored Nov 20, 2023
2 parents 63480ba + 993cfc7 commit f2e8fdf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions livechat/utils/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self,
http2: bool,
proxies=None,
verify: bool = True,
disable_logging: bool = False):
disable_logging: bool = False,
timeout: float = httpx.Timeout(15)):
logger = HttpxLogger(disable_logging=disable_logging)
self.base_url = base_url
self.session = httpx.Client(http2=http2,
Expand All @@ -24,7 +25,8 @@ def __init__(self,
'response': [logger.log_response]
},
proxies=proxies,
verify=verify)
verify=verify,
timeout=timeout)

def modify_header(self, header: dict) -> None:
''' Modifies provided header in session object.
Expand Down
4 changes: 2 additions & 2 deletions livechat/utils/ws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ def send(self,
logger.info(f'\nRESPONSE:\n{json.dumps(response, indent=4)}')
return RtmResponse(response)

def _wait_till_sock_connected(self, timeout: float = 3) -> NoReturn:
def _wait_till_sock_connected(self, timeout: float = 10) -> NoReturn:
''' Polls until `self.sock` is connected.
Args:
timeout (float): timeout value in seconds, default 3. '''
timeout (float): timeout value in seconds, default 10. '''
if timeout < 0:
raise TimeoutError('Timed out waiting for WebSocket to open.')
try:
Expand Down

0 comments on commit f2e8fdf

Please sign in to comment.