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

Lazily fetch django user only on first load #33821

Merged
merged 1 commit into from
Nov 30, 2023
Merged

Conversation

esoergel
Copy link
Contributor

@esoergel esoergel commented Nov 30, 2023

Product Description

This is a performance improvement

Technical Summary

That call to user.get_django_user() takes something like 2.5 seconds on prod, since it does an inexact match:

        return queryset.get(username__iexact=self.username)

@gherceg is investigating whether it would be possible to switch to an exact match, which is much much faster. Meanwhile, it'd be better to skip the lookup regardless, and it turns out that's easy to do. From the docs:

If there are any callables in defaults, evaluate them

Feature Flag

Safety Assurance

Safety story

This is a trivially simple change, and I believe test coverage is sufficient (though I'm verifying the performance improvement on staging)

Automated test coverage

QA Plan

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@esoergel esoergel added the product/invisible Change has no end-user visible impact label Nov 30, 2023
@esoergel esoergel marked this pull request as ready for review November 30, 2023 21:04
@gherceg gherceg merged commit e8df095 into master Nov 30, 2023
13 checks passed
@gherceg gherceg deleted the es/user-data-fix branch November 30, 2023 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product/invisible Change has no end-user visible impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants