Skip to content

Commit

Permalink
Merge pull request #7964 from chrisburr/avoid-log-lock
Browse files Browse the repository at this point in the history
[8.0] Avoid locking in MessageQueueHandler
  • Loading branch information
chaen authored Dec 20, 2024
2 parents 2c277f1 + a43d58f commit 70f7aae
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 70f7aae

Please sign in to comment.