pysmarlaapi 0.9.2__py3-none-any.whl → 0.9.3__py3-none-any.whl
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.
Potentially problematic release.
This version of pysmarlaapi might be problematic. Click here for more details.
- pysmarlaapi/__init__.py +1 -1
- pysmarlaapi/connection_hub/__init__.py +10 -6
- {pysmarlaapi-0.9.2.dist-info → pysmarlaapi-0.9.3.dist-info}/METADATA +1 -1
- {pysmarlaapi-0.9.2.dist-info → pysmarlaapi-0.9.3.dist-info}/RECORD +6 -6
- {pysmarlaapi-0.9.2.dist-info → pysmarlaapi-0.9.3.dist-info}/WHEEL +0 -0
- {pysmarlaapi-0.9.2.dist-info → pysmarlaapi-0.9.3.dist-info}/licenses/LICENSE +0 -0
pysmarlaapi/__init__.py
CHANGED
|
@@ -37,13 +37,12 @@ class ConnectionHub:
|
|
|
37
37
|
self,
|
|
38
38
|
event_loop: asyncio.AbstractEventLoop,
|
|
39
39
|
connection: Connection,
|
|
40
|
-
|
|
41
|
-
backoff: int = 300,
|
|
40
|
+
max_delay: int = 256,
|
|
42
41
|
):
|
|
43
42
|
self.connection: Connection = connection
|
|
44
43
|
self._loop = event_loop
|
|
45
|
-
self.
|
|
46
|
-
self.
|
|
44
|
+
self._retry_delay = 1 # Initial connection retry delay
|
|
45
|
+
self._max_delay = max_delay
|
|
47
46
|
|
|
48
47
|
self.logger = logging.getLogger(f"{__package__}[{self.connection.token.serialNumber}]")
|
|
49
48
|
|
|
@@ -84,6 +83,7 @@ class ConnectionHub:
|
|
|
84
83
|
await listener(value)
|
|
85
84
|
|
|
86
85
|
async def on_open_function(self):
|
|
86
|
+
self._retry_delay = 1
|
|
87
87
|
self.logger.info("Connection to server established")
|
|
88
88
|
|
|
89
89
|
async def on_close_function(self):
|
|
@@ -114,10 +114,14 @@ class ConnectionHub:
|
|
|
114
114
|
self.logger.warning("Error during connection: %s: %s", type(e).__name__, str(e))
|
|
115
115
|
|
|
116
116
|
# Random backoff to avoid simultaneous connection attempts
|
|
117
|
-
|
|
118
|
-
await event_wait(self._wake, self.
|
|
117
|
+
jitter = random.uniform(0, 0.5) * self._retry_delay
|
|
118
|
+
await event_wait(self._wake, self._retry_delay + jitter)
|
|
119
119
|
self._wake.clear()
|
|
120
120
|
|
|
121
|
+
# Double the delay for the next attempt
|
|
122
|
+
if self._retry_delay < self._max_delay:
|
|
123
|
+
self._retry_delay *= 2
|
|
124
|
+
|
|
121
125
|
def wake_up(self):
|
|
122
126
|
self._wake.set()
|
|
123
127
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
pysmarlaapi/__init__.py,sha256=
|
|
1
|
+
pysmarlaapi/__init__.py,sha256=xSrA3ZAl-0UUKk_KVble3F2UoRkGUAanIJvs0ZO7EXI,90
|
|
2
2
|
pysmarlaapi/classes/__init__.py,sha256=N-ZV3Id_t5ciovUlPUGCk5SLLiMUonRoQZWpfOU4ZsM,69
|
|
3
3
|
pysmarlaapi/classes/auth_token.py,sha256=dpo0lBT9Advm3Iyxu-fT9sq078U2OxgXXBuF5gbBZkM,942
|
|
4
4
|
pysmarlaapi/classes/connection.py,sha256=vVC0Ur0KQUb4pNDVuCYnfk-JXs-O-FwYVO-2y1E2g6g,1551
|
|
5
|
-
pysmarlaapi/connection_hub/__init__.py,sha256=
|
|
5
|
+
pysmarlaapi/connection_hub/__init__.py,sha256=k8s4VNO0QeINLycN94Fl5YXr1PcHkfvEI8GWimqTD_A,4776
|
|
6
6
|
pysmarlaapi/federwiege/__init__.py,sha256=7Fl_GnwN6GbS8fhkHdfMhuYFospKnap40pvUtSGIeoE,1933
|
|
7
7
|
pysmarlaapi/federwiege/classes/__init__.py,sha256=DFJJVOKpra40S4ZX_oq2RyMazg6Nx0c8hoPggmj1bXA,60
|
|
8
8
|
pysmarlaapi/federwiege/classes/property.py,sha256=S5Zzo9cXDJMFcQG1vCw1eO-oqeSpQs2YjxWouN_KRkU,1032
|
|
@@ -11,7 +11,7 @@ pysmarlaapi/federwiege/services/__init__.py,sha256=bJuOsk0lw9WWxB1NZodRTL8Pm_Ra8
|
|
|
11
11
|
pysmarlaapi/federwiege/services/analyser_service.py,sha256=xRPvSO5FdwX-gqWLWYQq8zvQSPnkE5Y3d-kG7N3awgg,1695
|
|
12
12
|
pysmarlaapi/federwiege/services/babywiege_service.py,sha256=6u0fSsRoWfv6A0Qad1WLD2yeRHMGnwbKVOJLxEqwzGE,1979
|
|
13
13
|
pysmarlaapi/federwiege/services/info_service.py,sha256=XqMSMU3BusB85V0O93rzliuJCK_H-PE4kXqJX-v7Kc4,1179
|
|
14
|
-
pysmarlaapi-0.9.
|
|
15
|
-
pysmarlaapi-0.9.
|
|
16
|
-
pysmarlaapi-0.9.
|
|
17
|
-
pysmarlaapi-0.9.
|
|
14
|
+
pysmarlaapi-0.9.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
15
|
+
pysmarlaapi-0.9.3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
16
|
+
pysmarlaapi-0.9.3.dist-info/METADATA,sha256=3iezX1ozOGN0Q9g2Wnff0-w_lJmZlAfYS6avnhjOTmI,1103
|
|
17
|
+
pysmarlaapi-0.9.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|