fix(core): resolve scheduler async syntax error and robust coroutine handling
- Handle coroutine objects in addition to functions in dispatch_with_entropy - Prevent RuntimeWarning for unawaited coroutines
This commit is contained in:
parent
357411e57c
commit
88d1d08561
1 changed files with 3 additions and 0 deletions
|
|
@ -36,7 +36,10 @@ class EntropyScheduler:
|
||||||
# Pre-execution jitter (simulate human hesitation)
|
# Pre-execution jitter (simulate human hesitation)
|
||||||
await asyncio.sleep(random.uniform(0.1, 0.8))
|
await asyncio.sleep(random.uniform(0.1, 0.8))
|
||||||
|
|
||||||
|
# Execute the task
|
||||||
if asyncio.iscoroutinefunction(task):
|
if asyncio.iscoroutinefunction(task):
|
||||||
await task()
|
await task()
|
||||||
|
elif asyncio.iscoroutine(task):
|
||||||
|
await task
|
||||||
else:
|
else:
|
||||||
task()
|
task()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue