From 42588ce52bd4dd81df867a82059ff084d85c0388 Mon Sep 17 00:00:00 2001 From: Carlos Matos Date: Sat, 31 Aug 2024 23:05:48 -0400 Subject: [PATCH] fix(eda): issue with timeout and session --- extensions/eda/plugins/event_source/eventstream.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/extensions/eda/plugins/event_source/eventstream.py b/extensions/eda/plugins/event_source/eventstream.py index b29e6bfb..2858956e 100644 --- a/extensions/eda/plugins/event_source/eventstream.py +++ b/extensions/eda/plugins/event_source/eventstream.py @@ -258,10 +258,10 @@ def __init__( """ logger.info("Initializing Stream: %s", stream_name) self.client: AIOFalconAPI = client + self.session: aiohttp.ClientSession = client.session self.stream_name: str = stream_name self.data_feed: str = stream["dataFeedURL"] self.token: str = stream["sessionToken"]["token"] - self.token_expires: str = stream["sessionToken"]["expiration"] self.refresh_url: str = stream["refreshActiveSessionURL"] self.partition: str = re.findall(r"v1/(\d+)", self.refresh_url)[0] self.offset: int = offset @@ -335,11 +335,10 @@ async def open_stream(self: "Stream") -> aiohttp.ClientResponse: "Authorization": f"Token {self.token}", }, "raise_for_status": True, - "timeout": aiohttp.ClientTimeout(total=float(self.refresh_interval) + 30), + "timeout": aiohttp.ClientTimeout(total=None), } - session = aiohttp.ClientSession() - self.spigot: aiohttp.ClientResponse = await session.get(**kwargs) + self.spigot: aiohttp.ClientResponse = await self.session.get(**kwargs) logger.info( "Successfully opened stream %s:%s", self.stream_name,