threads: make sure logger and substitution singletons are not reused (#24078)
This commit is contained in:
parent
3cd48901e7
commit
93374961c2
|
@ -48,7 +48,7 @@ class TenantAwareThread(threading.Thread):
|
|||
def __init__(self, *args, **kwargs):
|
||||
self.publisher = copy.copy(get_publisher())
|
||||
if self.publisher:
|
||||
self.publisher.pgconn = None
|
||||
self.publisher.detach()
|
||||
super(TenantAwareThread, self).__init__(*args, **kwargs)
|
||||
|
||||
def run(self):
|
||||
|
|
|
@ -767,6 +767,12 @@ class QommonPublisher(Publisher, object):
|
|||
publisher.set_config()
|
||||
return publisher
|
||||
|
||||
def detach(self):
|
||||
# reset structures that would otherwise be shared between threads
|
||||
self.pgconn = None
|
||||
self._app_logger = None
|
||||
self.substitutions = Substitutions()
|
||||
|
||||
extra_dirs = None
|
||||
@classmethod
|
||||
def register_extra_dir(cls, dir):
|
||||
|
|
Loading…
Reference in New Issue