Skip to content

Instantly share code, notes, and snippets.



Created Mar 13, 2020
What would you like to do?
import asyncio
loop = asyncio.get_event_loop()
sema = asyncio.Semaphore(value=10)
async def send(msg):
async def income(msg):
if not sema.locked():
await sema.acquire()
await send(msg)
loop.call_later(5, sema.release())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.