From cb318a533e87092b5e272832750f25c319feabeb Mon Sep 17 00:00:00 2001 From: Chris Burr Date: Fri, 20 Dec 2024 11:47:27 +0100 Subject: [PATCH] sweep: #7964 Avoid locking in MessageQueueHandler --- .../standardLogging/Handler/MessageQueueHandler.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/DIRAC/FrameworkSystem/private/standardLogging/Handler/MessageQueueHandler.py b/src/DIRAC/FrameworkSystem/private/standardLogging/Handler/MessageQueueHandler.py index 7db15f6437b..501748dbb3a 100644 --- a/src/DIRAC/FrameworkSystem/private/standardLogging/Handler/MessageQueueHandler.py +++ b/src/DIRAC/FrameworkSystem/private/standardLogging/Handler/MessageQueueHandler.py @@ -47,3 +47,15 @@ def emit(self, record): strRecord = self.format(record) if self.producer is not None: self.producer.put(json.loads(strRecord)) + + def handle(self, record): + """ + Conditionally emit the specified logging record. + + Override the handle method from logging.Handler as there is no need to + acquire the lock to emit the record. + """ + rv = self.filter(record) + if rv: + self.emit(record) + return rv