From 4ece77439570ca1b7aaa9ae50cc5755c0d1a68ba Mon Sep 17 00:00:00 2001 From: Jordi Masip Date: Fri, 21 May 2021 18:13:15 +0200 Subject: [PATCH] wip --- guillotina/db/transaction.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/guillotina/db/transaction.py b/guillotina/db/transaction.py index 5874f9b1d..bf41799cd 100644 --- a/guillotina/db/transaction.py +++ b/guillotina/db/transaction.py @@ -688,3 +688,13 @@ async def __aenter__(self): async def __aexit__(self, *args): return self.__exit__() + + def __del__(self): + if self._db_conn is not None: + logger.error( + f""" + Found a leak of pg connection {self._db_conn} in txn {self}. + It's not possible to return the connection to the pool + (__del__ function is not async) + """ + )