[issue38354] Fix for bug 30378 regressed SysLogHandler by making it resolve addresses at initialization instead of in `.emit()`

Enji Cooper report at bugs.python.org
Wed Oct 2 18:15:33 EDT 2019


Enji Cooper <yaneurabeya at gmail.com> added the comment:

Capturing more context here, based on internal discussion: other handlers are doing address resolution in `emit()` (HTTPHandler, SMTPHandler), which is expensive. In order for SysLogHandler to not regress behavior and not become expensive, performance-wise, it would probably be best to use `functools.lru_cache()`, using the address and a timeout as the key when resolving the addresses to avoid always doing address resolutions, e.g., DNS lookups: https://docs.python.org/3/library/functools.html#functools.lru_cache .

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38354>
_______________________________________


More information about the Python-bugs-list mailing list