diff --git a/trytond/bus.py b/trytond/bus.py index b2869dcdc8..2c07a22d97 100644 --- a/trytond/bus.py +++ b/trytond/bus.py @@ -149,12 +149,11 @@ class LongPollingBus: raise NotImplementedException logger.info("listening on channel '%s'", cls._channel) - conn = db.get_connection() + conn = db.get_connection(autocommit=True) pid = os.getpid() try: cursor = conn.cursor() cursor.execute('LISTEN "%s"' % cls._channel) - conn.commit() cls._messages[database] = messages = _MessageQueue(_cache_timeout) diff --git a/trytond/cache.py b/trytond/cache.py index 2f39d06134..489454fd88 100644 --- a/trytond/cache.py +++ b/trytond/cache.py @@ -293,13 +293,12 @@ class MemoryCache(BaseCache): raise NotImplementedError logger.info("listening on channel '%s' of '%s'", cls._channel, dbname) - conn = database.get_connection() + conn = database.get_connection(autocommit=True) pid = os.getpid() current_thread = threading.current_thread() try: cursor = conn.cursor() cursor.execute('LISTEN "%s"' % cls._channel) - conn.commit() while cls._listener.get((pid, dbname)) == current_thread: readable, _, _ = select.select([conn], [], [])