Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: add lru cache for users and courses #458

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions event_routing_backends/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import uuid
from urllib.parse import parse_qs, urlparse

from functools import lru_cache
from dateutil.parser import parse
from django.conf import settings
from django.contrib.auth import get_user_model
Expand Down Expand Up @@ -51,7 +52,7 @@ def get_uuid5(namespace_key, name):
base_namespace = uuid.uuid5(base_uuid, namespace_key)
return uuid.uuid5(base_namespace, name)


@lru_cache
def get_anonymous_user_id(username_or_id, external_type):
"""
Generate anonymous user id.
Expand Down Expand Up @@ -95,7 +96,6 @@ def get_anonymous_user_id(username_or_id, external_type):

return anonymous_id


def get_user(username_or_id):
"""
Get user by username or user id.
Expand Down Expand Up @@ -149,7 +149,7 @@ def get_user_email(username_or_id):

return user_email


@lru_cache
def get_course_from_id(course_id):
"""
Get Course object using the `course_id`.
Expand Down
Loading