Added try guard to sio.receive in writer
This commit is contained in:
parent
5df9dd4598
commit
4527954cad
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
from typing import Callable, NewType, Optional
|
||||
from socketio import AsyncClient, AsyncSimpleClient
|
||||
import socketio
|
||||
from aiohttp import ClientSession, ClientTimeout
|
||||
from aiohttp_socks import ProxyConnector
|
||||
from PIL import Image, ImageFont, ImageDraw, ImageFilter, ImageSequence, ImageChops
|
||||
|
@ -255,7 +256,10 @@ class AsyncBotManager:
|
|||
await sio.emit("toggle_bit", {"index": index})
|
||||
await asyncio.sleep(delay)
|
||||
self._active.add(bot_index)
|
||||
try:
|
||||
await sio.receive(0.1)
|
||||
except socketio.exceptions.TimeoutError:
|
||||
print(f"read failed in {bot_index}")
|
||||
|
||||
async def __aenter__(self):
|
||||
self._listener_task = asyncio.create_task(self.listener())
|
||||
|
@ -412,7 +416,7 @@ async def amain() -> None:
|
|||
)
|
||||
else:
|
||||
res = await asyncio.gather(
|
||||
*[mgr.writer(i) for i in range(settings["n_bots"])],
|
||||
*[mgr.writer(i, None, settings["delay"]) for i in range(settings["n_bots"])],
|
||||
return_exceptions=True,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue