stompman 2.0.0__tar.gz → 2.0.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stompman
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Python STOMP client with pleasant API
5
5
  Project-URL: repository, https://github.com/community-of-python/stompman
6
6
  Author-email: Lev Vereshchagin <mail@vrslev.com>
@@ -175,4 +175,4 @@ class Client:
175
175
  def is_alive(self) -> bool:
176
176
  return (
177
177
  self._connection_manager._active_connection_state or False # noqa: SLF001
178
- ) and self._connection_manager._active_connection_state.is_alive() # noqa: SLF001
178
+ ) and self._connection_manager._active_connection_state.is_alive(self.check_server_alive_interval_factor) # noqa: SLF001
@@ -28,10 +28,13 @@ class ActiveConnectionState:
28
28
  lifespan: "AbstractConnectionLifespan"
29
29
  server_heartbeat: Heartbeat
30
30
 
31
- def is_alive(self) -> bool:
31
+ def is_alive(self, check_server_alive_interval_factor: int) -> bool:
32
32
  if not (last_read_time := self.connection.last_read_time):
33
33
  return True
34
- return (self.server_heartbeat.will_send_interval_ms / 1000) > (time.time() - last_read_time)
34
+
35
+ return (self.server_heartbeat.will_send_interval_ms / 1000 * check_server_alive_interval_factor) > (
36
+ time.time() - last_read_time
37
+ )
35
38
 
36
39
 
37
40
  @dataclass(kw_only=True, slots=True)
@@ -99,7 +102,7 @@ class ConnectionManager:
99
102
  await asyncio.sleep(receive_heartbeat_interval_seconds * self.check_server_alive_interval_factor)
100
103
  if not self._active_connection_state:
101
104
  continue
102
- if not self._active_connection_state.is_alive():
105
+ if not self._active_connection_state.is_alive(self.check_server_alive_interval_factor):
103
106
  self._active_connection_state = None
104
107
 
105
108
  async def _create_connection_to_one_server(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes