Skip to content

Commit 96d811c

Browse files
committed
remove heartbeat
1 parent 3cf0222 commit 96d811c

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

UnleashClient/streaming/connector.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import threading
2-
import time
32
from typing import Callable, Optional
43

54
from ld_eventsource import SSEClient
@@ -25,7 +24,6 @@ def __init__(
2524
event_processor: StreamingEventProcessor,
2625
on_ready: Optional[Callable[[], None]] = None,
2726
sse_client_factory: Optional[Callable[[str, dict, int], SSEClient]] = None,
28-
heartbeat_timeout: int = 60,
2927
backoff_initial: float = 2.0,
3028
backoff_max: float = 30.0,
3129
backoff_multiplier: float = 2.0,
@@ -37,7 +35,6 @@ def __init__(
3735
self._timeout = request_timeout
3836
self._on_ready = on_ready
3937
self._sse_factory = sse_client_factory
40-
self._hb_timeout = heartbeat_timeout
4138
self._backoff_initial = backoff_initial
4239
self._backoff_max = backoff_max
4340
self._backoff_multiplier = backoff_multiplier
@@ -99,16 +96,12 @@ def _run(self): # noqa: PLR0912
9996
logger=LOGGER,
10097
)
10198

102-
last_event_time = time.time()
103-
10499
for event in client.events:
105100
if self._stop.is_set():
106101
break
107102
if not event.event:
108103
continue
109104

110-
last_event_time = time.time()
111-
112105
self._processor.process(event)
113106
if event.event == "unleash-connected" and self._processor.hydrated:
114107
if self._on_ready:
@@ -117,15 +110,6 @@ def _run(self): # noqa: PLR0912
117110
except Exception as cb_exc: # noqa: BLE001
118111
LOGGER.debug("Ready callback error: %s", cb_exc)
119112

120-
if self._hb_timeout and (
121-
time.time() - last_event_time > self._hb_timeout
122-
):
123-
LOGGER.warning("Heartbeat timeout exceeded; reconnecting")
124-
try:
125-
client.interrupt() # Don't break, rely on SSE client retry
126-
except Exception: # noqa: BLE001
127-
break
128-
129113
LOGGER.debug("SSE stream ended")
130114

131115
except Exception as exc: # noqa: BLE001

0 commit comments

Comments
 (0)