Commit e5b4f7ab authored by mathieui's avatar mathieui

fix: do not use re.match() on existing Pattern objects

this is duplicating effort and going through re._compile once more
approximately slows down the log parsing by 15%
parent 1456566f
Pipeline #3983 failed with stages
in 5 minutes and 3 seconds
......@@ -82,10 +82,10 @@ def parse_log_line(msg: str, jid: str = '') -> Optional[LogItem]:
:param jid: jid (for error logging)
:returns: The LogItem or None on error
match = re.match(MESSAGE_LOG_RE, msg)
match = MESSAGE_LOG_RE.match(msg)
if match:
return LogMessage(*match.groups())
match = re.match(INFO_LOG_RE, msg)
match = INFO_LOG_RE.match(msg)
if match:
return LogInfo(*match.groups())
log.debug('Error while parsing %s’s logs: “%s”', jid, msg)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment