From f98e4ce3034d8ccb024bb43d86b883f17c0dbfb8 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Wed, 17 Jan 2024 16:14:50 -0700 Subject: [PATCH] Revert "event stream: update the realtime connection ID on every request" This reverts commit b4fec48ec311e1ee6456536ec8b206cb8c46a4d5. --- linkedin_messaging/linkedin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linkedin_messaging/linkedin.py b/linkedin_messaging/linkedin.py index f0f6024..cb6dfe8 100644 --- a/linkedin_messaging/linkedin.py +++ b/linkedin_messaging/linkedin.py @@ -577,8 +577,10 @@ async def _listen_to_event_stream(self): if cc := data.get("com.linkedin.realtimefrontend.ClientConnection", {}): logging.info(f"Got realtime connection ID: {cc.get('id')}") - self._request_headers["x-li-realtime-session"] = cc.get("id") - self._realtime_sesion_id = cc.get("id") + if not self._realtime_sesion_id: + logging.info("No existing realtime connection ID, setting the ID") + self._request_headers["x-li-realtime-session"] = cc.get("id") + self._realtime_sesion_id = cc.get("id") event_payload = data.get("com.linkedin.realtimefrontend.DecoratedEvent", {}).get( "payload", {}