Skip to content

Commit 24e3f7d

Browse files
authored
Merge pull request #7969 from DIRACGridBot/cherry-pick-2-70f7aae13-integration
[sweep:integration] Avoid locking in MessageQueueHandler
2 parents 075a6e0 + cb318a5 commit 24e3f7d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/DIRAC/FrameworkSystem/private/standardLogging/Handler/MessageQueueHandler.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,15 @@ def emit(self, record):
4747
strRecord = self.format(record)
4848
if self.producer is not None:
4949
self.producer.put(json.loads(strRecord))
50+
51+
def handle(self, record):
52+
"""
53+
Conditionally emit the specified logging record.
54+
55+
Override the handle method from logging.Handler as there is no need to
56+
acquire the lock to emit the record.
57+
"""
58+
rv = self.filter(record)
59+
if rv:
60+
self.emit(record)
61+
return rv

0 commit comments

Comments
 (0)