Dev-iL commented on code in PR #67800:
URL: https://github.com/apache/airflow/pull/67800#discussion_r3368944325
##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:
##########
@@ -2154,6 +2155,19 @@ def setup_method(self):
def teardown_method(self):
clear_db_runs()
+ # ti_heartbeat runs on the async engine. The async engine binds its pool to
+ # the event loop that created it (once per process), but the test harness
+ # builds a fresh FastAPI app and event loop per test, so a pooled
connection
Review Comment:
Right, the async engine binds its pool to the event loop that created it,
and pytest-asyncio runs a fresh function-scoped loop per test, so it gets
rebuilt each time. Sync engines are reused across tests, which is why this
fixture only shows up with async and why the cost does indeed grow as more
routes move over. BTW, this mirrors the existing `TestWaitDagRun` workaround.
If we move the loop scope to module/session (to have one engine shared
across a module), we'll be trading performance for per-test isolation, won't we?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]