diff options
| author | bd <bdunahu@operationnull.com> | 2025-07-29 22:57:21 -0400 |
|---|---|---|
| committer | bd <bdunahu@operationnull.com> | 2025-07-29 22:57:21 -0400 |
| commit | 2be1331b97e2028a59087ad229cc71a88b72dec6 (patch) | |
| tree | 0a6f323e9e77ced1326bf0de7a6c75ea4356da3f /aergia/aergia.py | |
| parent | a27bc8281a9795397fa5c01445140ba6504960f7 (diff) | |
Fix bug where unstarted tasks would attribute time to coro decl
Diffstat (limited to 'aergia/aergia.py')
| -rwxr-xr-x | aergia/aergia.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/aergia/aergia.py b/aergia/aergia.py index b99f06d..efc68e2 100755 --- a/aergia/aergia.py +++ b/aergia/aergia.py @@ -54,6 +54,8 @@ import threading import time import traceback +import pprint + orig_thread_join = threading.Thread.join @@ -205,7 +207,6 @@ class Aergia(object): if isinstance(loop, asyncio.AbstractEventLoop): return loop else: - # print(frame.f_code.co_name) frame = frame.f_back return None @@ -271,8 +272,16 @@ class Aergia(object): idle = [] current = asyncio.current_task(loop) for task in asyncio.all_tasks(loop): + # the task is not idle if task == current: continue + # the task hasn't even run yet + # assumes that all started tasks are sitting at an await + # statement. + # if this isn't the case, the associated coroutine will + # be 'waiting' on the coroutine declaration. No! Bad! + if getattr(task.get_coro(), 'cr_await', None) is None: + continue coro = task.get_coro() if coro: f = Aergia._get_deepest_traceable_frame(coro) |
