1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Disabled long polling. There's now a 5 seconds delay between each check

This commit is contained in:
Steffo 2017-03-22 18:01:52 +01:00
parent c8eae01878
commit 4caaea2dc3

View file

@ -40,8 +40,8 @@ class Bot:
for u in self.updates:
loop.create_task(self.parse_update(u))
self.updates = list()
# Wait 1 second between two requests, allowing the parsing of updates.
await asyncio.sleep(1)
# Wait 5 seconds between two requests, allowing the parsing of updates.
await asyncio.sleep(5)
async def update_bot_data(self):
"""Update self.user_data with the latest information from /getMe."""
@ -51,7 +51,8 @@ class Bot:
async def get_updates(self):
"""Get the latest updates from the Telegram API with /getUpdates."""
try:
data = await self.api_request("getUpdates", offset=self.offset, timeout=300)
# TODO: Fix long polling
data = await self.api_request("getUpdates", offset=self.offset)
except asyncio.TimeoutError:
return
for update in data: