Projet

Général

Profil

0001-threads-make-sure-logger-and-substitution-singletons.patch

Frédéric Péters, 25 mai 2018 11:04

Télécharger (1,45 ko)

Voir les différences:

Subject: [PATCH] threads: make sure logger and substitution singletons are not
 reused (#24078)

 wcs/qommon/__init__.py  | 2 +-
 wcs/qommon/publisher.py | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
wcs/qommon/__init__.py
48 48
    def __init__(self, *args, **kwargs):
49 49
        self.publisher = copy.copy(get_publisher())
50 50
        if self.publisher:
51
            self.publisher.pgconn = None
51
            self.publisher.reset()
52 52
        super(TenantAwareThread, self).__init__(*args, **kwargs)
53 53

  
54 54
    def run(self):
wcs/qommon/publisher.py
767 767
        publisher.set_config()
768 768
        return publisher
769 769

  
770
    def reset(self):
771
        # reset structures that would otherwise be shared between threads
772
        self.pgconn = None
773
        self._app_logger = None
774
        self.substitutions = Substitutions()
775

  
770 776
    extra_dirs = None
771 777
    @classmethod
772 778
    def register_extra_dir(cls, dir):
773
-