details:   https://code.tryton.org/tryton/commit/b4ccf2f1eb7c
branch:    7.8
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 dcc2939f0c48 -r b4ccf2f1eb7c 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
@@ -255,6 +255,8 @@
 
     @classmethod
     def sync(cls, transaction):
+        if not Pool().ready:
+            return
         if cls._clean_last is None:
             cls._clean_last = dt.datetime.now()
             return
@@ -297,7 +299,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