From 0860f84a39f629be57a43e27351cb898c384ee39 Mon Sep 17 00:00:00 2001 From: Raphael Deem Date: Wed, 8 Mar 2017 18:50:41 -0800 Subject: [PATCH] close connection in asyncpg example --- examples/sanic_asyncpg_example.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/sanic_asyncpg_example.py b/examples/sanic_asyncpg_example.py index a35ff01a..2f767a46 100644 --- a/examples/sanic_asyncpg_example.py +++ b/examples/sanic_asyncpg_example.py @@ -41,12 +41,14 @@ async def create_db(app, loop): for i in range(0, 100): await conn.execute(f"""INSERT INTO sanic_post (id, content, post_date) VALUES ({i}, {i}, now())""") + await conn.close() @app.route("/") async def handler(request): conn = await connect(**DB_CONFIG) results = await conn.fetch('SELECT * FROM sanic_post') + await conn.close() return json({'posts': jsonify(results)})