Skip to content

🪲 BUG-#211: Fix async task execution to reuse event loops#227

Merged
FernandoCelmer merged 2 commits intodevelopfrom
feature/211
Apr 9, 2026
Merged

🪲 BUG-#211: Fix async task execution to reuse event loops#227
FernandoCelmer merged 2 commits intodevelopfrom
feature/211

Conversation

@FernandoCelmer
Copy link
Copy Markdown
Member

Description

Fix Action._call_func() to properly handle async functions by reusing existing event loops instead of always creating new ones with asyncio.run().

Issue: 📌 ISSUE-#211

Changes

  • Replace asyncio.iscoroutinefunction with inspect.iscoroutinefunction (removes Python 3.16 deprecation warning)
  • Add 3 async execution paths:
    • No running loop → asyncio.run() (creates new loop)
    • Loop exists but not running → loop.run_until_complete() (reuses loop)
    • Loop is running (Jupyter/IPython) → ThreadPoolExecutor fallback
  • Move concurrent.futures import to top-level
  • Simplify flow with early return for sync functions

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@FernandoCelmer FernandoCelmer added the bug Something isn't working label Apr 9, 2026
@FernandoCelmer FernandoCelmer self-assigned this Apr 9, 2026
@FernandoCelmer FernandoCelmer merged commit 7d32ae9 into develop Apr 9, 2026
10 checks passed
@FernandoCelmer FernandoCelmer deleted the feature/211 branch April 9, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant