stompman 3.6.0__tar.gz → 3.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stompman-3.6.0 → stompman-3.7.0}/PKG-INFO +1 -1
- {stompman-3.6.0 → stompman-3.7.0}/stompman/connection_manager.py +2 -18
- {stompman-3.6.0 → stompman-3.7.0}/.gitignore +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/pyproject.toml +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/__init__.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/client.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/config.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/connection.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/connection_lifespan.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/errors.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/frames.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/logger.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/py.typed +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/serde.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/subscription.py +0 -0
- {stompman-3.6.0 → stompman-3.7.0}/stompman/transaction.py +0 -0
|
@@ -55,12 +55,10 @@ class ConnectionManager:
|
|
|
55
55
|
_reconnect_lock: asyncio.Lock = field(init=False, default_factory=asyncio.Lock)
|
|
56
56
|
_task_group: asyncio.TaskGroup = field(init=False, default_factory=asyncio.TaskGroup)
|
|
57
57
|
_send_heartbeat_task: asyncio.Task[None] = field(init=False, repr=False)
|
|
58
|
-
_check_server_heartbeat_task: asyncio.Task[None] = field(init=False, repr=False)
|
|
59
58
|
|
|
60
59
|
async def __aenter__(self) -> Self:
|
|
61
60
|
await self._task_group.__aenter__()
|
|
62
61
|
self._send_heartbeat_task = self._task_group.create_task(asyncio.sleep(0))
|
|
63
|
-
self._check_server_heartbeat_task = self._task_group.create_task(asyncio.sleep(0))
|
|
64
62
|
self._active_connection_state = await self._get_active_connection_state(is_initial_call=True)
|
|
65
63
|
return self
|
|
66
64
|
|
|
@@ -68,8 +66,7 @@ class ConnectionManager:
|
|
|
68
66
|
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
|
|
69
67
|
) -> None:
|
|
70
68
|
self._send_heartbeat_task.cancel()
|
|
71
|
-
self.
|
|
72
|
-
await asyncio.wait([self._send_heartbeat_task, self._check_server_heartbeat_task])
|
|
69
|
+
await asyncio.wait([self._send_heartbeat_task])
|
|
73
70
|
await self._task_group.__aexit__(exc_type, exc_value, traceback)
|
|
74
71
|
|
|
75
72
|
if not self._active_connection_state:
|
|
@@ -82,13 +79,9 @@ class ConnectionManager:
|
|
|
82
79
|
|
|
83
80
|
def _restart_heartbeat_tasks(self, server_heartbeat: Heartbeat) -> None:
|
|
84
81
|
self._send_heartbeat_task.cancel()
|
|
85
|
-
self._check_server_heartbeat_task.cancel()
|
|
86
82
|
self._send_heartbeat_task = self._task_group.create_task(
|
|
87
83
|
self._send_heartbeats_forever(server_heartbeat.want_to_receive_interval_ms)
|
|
88
84
|
)
|
|
89
|
-
self._check_server_heartbeat_task = self._task_group.create_task(
|
|
90
|
-
self._check_server_heartbeat_forever(server_heartbeat.will_send_interval_ms)
|
|
91
|
-
)
|
|
92
85
|
|
|
93
86
|
async def _send_heartbeats_forever(self, send_heartbeat_interval_ms: int) -> None:
|
|
94
87
|
send_heartbeat_interval_seconds = send_heartbeat_interval_ms / 1000
|
|
@@ -96,15 +89,6 @@ class ConnectionManager:
|
|
|
96
89
|
await self.write_heartbeat_reconnecting()
|
|
97
90
|
await asyncio.sleep(send_heartbeat_interval_seconds)
|
|
98
91
|
|
|
99
|
-
async def _check_server_heartbeat_forever(self, receive_heartbeat_interval_ms: int) -> None:
|
|
100
|
-
receive_heartbeat_interval_seconds = receive_heartbeat_interval_ms / 1000
|
|
101
|
-
while True:
|
|
102
|
-
await asyncio.sleep(receive_heartbeat_interval_seconds * self.check_server_alive_interval_factor)
|
|
103
|
-
if not self._active_connection_state:
|
|
104
|
-
continue
|
|
105
|
-
if not self._active_connection_state.is_alive(self.check_server_alive_interval_factor):
|
|
106
|
-
self._clear_active_connection_state(ConnectionLostError(reason="server heartbeat timeout"))
|
|
107
|
-
|
|
108
92
|
async def _create_connection_to_one_server(
|
|
109
93
|
self, server: ConnectionParameters
|
|
110
94
|
) -> tuple[AbstractConnection, ConnectionParameters] | None:
|
|
@@ -182,7 +166,7 @@ class ConnectionManager:
|
|
|
182
166
|
if not self._active_connection_state:
|
|
183
167
|
return
|
|
184
168
|
LOGGER.warning(
|
|
185
|
-
"connection lost. reason: %
|
|
169
|
+
"connection lost. reason: %r, connection_parameters: %s",
|
|
186
170
|
error_reason.reason,
|
|
187
171
|
self._active_connection_state.lifespan.connection_parameters,
|
|
188
172
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|