Improve logbook context augment performance (#106926)

Makes LazyEventPartialState a bit lazier since almost all the
properties are never called.
This commit is contained in:
J. Nick Koston 2024-01-07 17:35:28 -10:00 committed by GitHub
parent d8c6534aff
commit 0b9992260a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 19 deletions

View file

@ -425,7 +425,7 @@ class EventCache:
def get(self, row: EventAsRow | Row) -> LazyEventPartialState:
"""Get the event from the row."""
if isinstance(row, EventAsRow):
if type(row) is EventAsRow: # noqa: E721 - this is never subclassed
return LazyEventPartialState(row, self._event_data_cache)
if event := self.event_cache.get(row):
return event