зеркало из
https://github.com/viginum-datalab/twscrape.git
synced 2025-10-29 21:16:25 +02:00
print log when account available for queue
Этот коммит содержится в:
родитель
8f28bd1258
Коммит
a378a9721e
@ -250,17 +250,20 @@ class AccountsPool:
|
|||||||
return Account.from_rs(rs) if rs else None
|
return Account.from_rs(rs) if rs else None
|
||||||
|
|
||||||
async def get_for_queue_or_wait(self, queue: str) -> Account:
|
async def get_for_queue_or_wait(self, queue: str) -> Account:
|
||||||
msg_show = False
|
msg_shown = False
|
||||||
while True:
|
while True:
|
||||||
account = await self.get_for_queue(queue)
|
account = await self.get_for_queue(queue)
|
||||||
if not account:
|
if not account:
|
||||||
if not msg_show:
|
if not msg_shown:
|
||||||
nat = await self.next_available_at(queue)
|
nat = await self.next_available_at(queue)
|
||||||
msg = f'No account available for queue "{queue}". Next available at {nat}'
|
msg = f'No account available for queue "{queue}". Next available at {nat}'
|
||||||
logger.info(msg)
|
logger.info(msg)
|
||||||
msg_show = True
|
msg_shown = True
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
if msg_shown:
|
||||||
|
logger.info(f"Account available for queue {queue}")
|
||||||
|
|
||||||
return account
|
return account
|
||||||
|
|
||||||
|
|||||||
Загрузка…
x
Ссылка в новой задаче
Block a user