Debug an async summariser that is no faster than the sequential version
Interview insights are lockedSee how often this is asked and which companies asked it with Buncho Pro.import asyncio, requests
async def summarize(text):
resp = requests.post(URL, json={"text": text}, timeout=30) # about 2 s per call
return resp.json()["summary"]
async def main(texts):
return await asyncio.gather(*(summarize(t) for t in texts))
asyncio.run(main(texts))