details:   https://code.tryton.org/tryton/commit/33621b5235fa
branch:    8.2
user:      Nicolas Évrard <[email protected]>
date:      Wed Sep 23 10:41:33 2026 +0200
description:
        Early exits cache synchronization call when initializing the Pool

        As threads could be launched when clean_timeout is 0, preforking WSGI 
could
        unfortunately fork while in the cache listening thread making the server
        unresponsive.

        Closes #15120
        (grafted from 69857991edf1f6dd9d0b535f7c0abe861c2b0c7f)
diffstat:

 trytond/trytond/cache.py |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r 71f61bb7189f -r 33621b5235fa trytond/trytond/cache.py
--- a/trytond/trytond/cache.py  Wed Sep 23 10:50:27 2026 +0200
+++ b/trytond/trytond/cache.py  Wed Sep 23 10:41:33 2026 +0200
@@ -256,6 +256,8 @@
 
     @classmethod
     def sync(cls, transaction):
+        if not Pool().ready:
+            return
         if cls._clean_last is None:
             cls._clean_last = dt.datetime.now()
             return
@@ -298,7 +300,7 @@
         cls._clean_last = dt.datetime.now()
 
     def sync_since(self, value):
-        return self._clean_last > value
+        return self._clean_last is not None and self._clean_last > value
 
     @classmethod
     def commit(cls, transaction):

Reply via email to