From 669534099639907a0813b6c66b29e9d1ca95229e Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 10 Jun 2025 15:03:51 -0400 Subject: Add 'async-off' flag for comparison, add comments --- tests/overload.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/overload.py (limited to 'tests/overload.py') diff --git a/tests/overload.py b/tests/overload.py new file mode 100644 index 0000000..21ee125 --- /dev/null +++ b/tests/overload.py @@ -0,0 +1,26 @@ +import asyncio +import time + +async def busy_task(): + await asyncio.sleep(3.0) + return 1 + +async def main(): + tasks = [asyncio.create_task(busy_task()) for i in range(5)] + + start_time = time.time() + try: + # this is to prevent waiting in 'select' all day, + # which makes the python intepreter not respond to + # mini-scalene / SCALENE + while True: + if time.time() - start_time > 3.5: + break + # print(asyncio.all_tasks()) + await asyncio.sleep(0) # yield + except KeyboardInterrupt: + pass + finally: + print("Done.") + +asyncio.run(main()) -- cgit v1.2.3