From b0e8a438d408d142edc47b67a7ec340dac2f9979 Mon Sep 17 00:00:00 2001 From: AhmadMasry Date: Thu, 1 Oct 2026 10:02:02 +0300 Subject: [PATCH] docs: use release_resources_async in PG async SQLAlchemy example The async example called the sync release_resources(), which never runs the async shutdown hooks. The failover topology monitor and host_monitoring_v2 monitors started by this example register their teardown via register_shutdown_hook, so they were left running until asyncio.run() cancelled them at exit. Switch to `await release_resources_async()`, matching the shutdown ordering in SqlAlchemySupport.md and the MySQL async example. --- docs/examples/PGSQLAlchemyAsyncFailover.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/PGSQLAlchemyAsyncFailover.py b/docs/examples/PGSQLAlchemyAsyncFailover.py index eb06f4515..1cd7182c4 100644 --- a/docs/examples/PGSQLAlchemyAsyncFailover.py +++ b/docs/examples/PGSQLAlchemyAsyncFailover.py @@ -31,7 +31,7 @@ from sqlalchemy.exc import OperationalError from sqlalchemy.ext.asyncio import create_async_engine -from aws_advanced_python_wrapper import release_resources +from aws_advanced_python_wrapper.aio import release_resources_async CLUSTER_ENDPOINT = "database.cluster-xyz.us-east-1.rds.amazonaws.com" DB_NAME = "postgres" @@ -69,7 +69,7 @@ async def main() -> None: await run_workload(engine) finally: await engine.dispose() - release_resources() + await release_resources_async() if __name__ == "__main__":