Skip to content

Commit

Permalink
Add web socket Max backoff time (#55)
Browse files Browse the repository at this point in the history
* Update max time for backoff

* add comment

* version bump docs

* Bump version: 0.4.1 → 0.4.2

* Bump version: 0.4.2 → 0.4.3
  • Loading branch information
fbradyirl authored Apr 24, 2024
1 parent 096ba8f commit ceebe78
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ and off you go!

* Always ensure there is a thread ID in the Activity before accessing it

### 0.4.2 (2024-Apr-24)

* Add max backoff time (#55)
* Attached files. Help, threading and log level overrides. (#54)
* add stop() call to gracefully exit the bot (#42)
* feat(20231212): add help image size parameter (#46)
* update websockets to 11.0.3 (#43)

[1]: https://github.com/aaugustin/websockets

[2]: https://github.com/CiscoDevNet/webexteamssdk
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.2
current_version = 0.4.3
commit = True
tag = True

Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
with open("README.md") as readme_file:
readme = readme_file.read()

# For latest unreleased version use
# `webexteamssdk@ git+https://github.com/WebexCommunity/WebexPythonSDK.git`
requirements = ["webexteamssdk==1.6.1", "coloredlogs", "websockets==11.0.3", "backoff"]

setup_requirements = ["pytest-runner"]
Expand Down Expand Up @@ -38,6 +40,6 @@
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/fbradyirl/webex_bot",
version="0.4.2",
version="version='0.4.3'",
zip_safe=False,
)
2 changes: 1 addition & 1 deletion webex_bot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Top-level package for Webex Bot."""

__author__ = """Finbarr Brady"""
__version__ = '0.4.1'
__version__ = '0.4.3'
9 changes: 5 additions & 4 deletions webex_bot/websockets/webex_websocket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
ssl_context = ssl.create_default_context()
ssl_context.load_verify_locations(certifi.where())

MAX_BACKOFF_TIME = 240

class WebexWebsocketClient(object):
def __init__(self,
Expand Down Expand Up @@ -190,10 +191,10 @@ async def _websocket_recv():
logger.warning(
f"An exception occurred while processing message. Ignoring. {messageProcessingException}")

@backoff.on_exception(backoff.expo, websockets.ConnectionClosedError)
@backoff.on_exception(backoff.expo, websockets.ConnectionClosedOK)
@backoff.on_exception(backoff.expo, websockets.ConnectionClosed)
@backoff.on_exception(backoff.expo, socket.gaierror)
@backoff.on_exception(backoff.expo, websockets.ConnectionClosedError, max_time=MAX_BACKOFF_TIME)
@backoff.on_exception(backoff.expo, websockets.ConnectionClosedOK, max_time=MAX_BACKOFF_TIME)
@backoff.on_exception(backoff.expo, websockets.ConnectionClosed, max_time=MAX_BACKOFF_TIME)
@backoff.on_exception(backoff.expo, socket.gaierror, max_time=MAX_BACKOFF_TIME)
async def _connect_and_listen():
ws_url = self.device_info['webSocketUrl']
logger.info(f"Opening websocket connection to {ws_url}")
Expand Down

0 comments on commit ceebe78

Please sign in to comment.