Aiohttp async

t0 = time.time ()

loop = asyncio.get_event_loop()
loop.run_until_complete(fetch(BASE_URL+"/43_43074/", callback=parse_url))
tasks = [fetch(BASE_URL + page_url, callback=parse_body, title=title) for title, page_url in TITLE2URL.items()]
loop.run_until_complete(asyncio.gather(*tasks[:500]))
loop.close()
elapsed = time.time() - t0
print("cost {}".format(elapsed))

what"s the difference between loop.run_until_complete (asyncio.gather (* tasks [: 500]) and loop.run_until_complete here?
and an await? what"s the difference?

Mar.20,2021

1. Each thread has an event loop. When the main thread calls asyncio.get_event_loop, an event loop is created. You need to throw the asynchronous task to the loop's run_until_complete method, and the event loop will arrange the execution of the co-program. As with the method name, the asynchronous task completion method is executed.
2.await is to coordinate the execution of those Synchronize tasks until they are completed.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34a28-404b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34a28-404b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?