Skip to content

perf(eventstore): Use cached project lookup in BaseEvent#106440

Merged
beezz merged 3 commits into
masterfrom
event-get-project-from-cache
Jan 16, 2026
Merged

perf(eventstore): Use cached project lookup in BaseEvent#106440
beezz merged 3 commits into
masterfrom
event-get-project-from-cache

Conversation

@beezz

@beezz beezz commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Switch from Project.objects.get() to Project.objects.get_from_cache() when
accessing the project property on BaseEvent.

The project property already uses a local instance cache (_project_cache),
but when the cache is cold, it was hitting the database directly. Using
get_from_cache() adds a layer of application-level caching that can reduce
redundant database queries when multiple events reference the same project.

Switch from direct database query to get_from_cache() when accessing
the project property. This avoids redundant database hits when the
same project is accessed multiple times.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 16, 2026
@beezz beezz enabled auto-merge (squash) January 16, 2026 14:38
The test assertion for exactly 1 query was invalidated by switching to
get_from_cache(), which may return the project from cache without
hitting the database.

Co-Authored-By: Claude <noreply@anthropic.com>
@beezz beezz merged commit f91a90b into master Jan 16, 2026
66 checks passed
@beezz beezz deleted the event-get-project-from-cache branch January 16, 2026 17:15
BYK pushed a commit that referenced this pull request Jan 19, 2026
Switch from `Project.objects.get()` to
`Project.objects.get_from_cache()` when
accessing the `project` property on `BaseEvent`.

The `project` property already uses a local instance cache
(`_project_cache`),
but when the cache is cold, it was hitting the database directly. Using
`get_from_cache()` adds a layer of application-level caching that can
reduce
redundant database queries when multiple events reference the same
project.

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants