mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Fix #1637
This commit is contained in:
parent
54ad1582aa
commit
147278733b
@ -26,9 +26,7 @@ REQUEST_LIMIT = 50
|
|||||||
|
|
||||||
class SessionManager:
|
class SessionManager:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(
|
self.session = None
|
||||||
limit=REQUEST_LIMIT
|
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
async def create_session(self):
|
async def create_session(self):
|
||||||
@ -38,6 +36,10 @@ class SessionManager:
|
|||||||
return self.session
|
return self.session
|
||||||
|
|
||||||
async def get_session(self):
|
async def get_session(self):
|
||||||
|
if self.session is None:
|
||||||
|
self.session = await self.create_session()
|
||||||
|
return self.session
|
||||||
|
|
||||||
if self.session.closed:
|
if self.session.closed:
|
||||||
self.session = await self.create_session()
|
self.session = await self.create_session()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user