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

Fix new internal user cache #299

Merged
merged 1 commit into from
May 7, 2024
Merged

Conversation

marcantoinedupre
Copy link
Contributor

The get_internal_user function was broken:

  • on first use when the key for the internal user pk is not in the cache => the get_or_create would not work because there is no user with ID 0 (get fails) and the unique username is already in use (create fails).

Copy link

codecov bot commented May 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.00%. Comparing base (c022ee4) to head (5c7b9ab).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #299      +/-   ##
==========================================
+ Coverage   90.98%   91.00%   +0.01%     
==========================================
  Files          32       32              
  Lines        2397     2402       +5     
==========================================
+ Hits         2181     2186       +5     
  Misses        216      216              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The `get_internal_user` function was broken:

- on first use when the key for the internal user pk is not in the cache => the get_or_create would not work because there is no user with ID 0 (get fails) and the unique username is already in use (create fails).

The try/except around `internal_user = User.objects.get(pk=id)` was added to make the tests pass. Maybe a concurrency issue/a transaction issue?
@marcantoinedupre marcantoinedupre merged commit 6fd81b8 into master May 7, 2024
11 checks passed
@marcantoinedupre marcantoinedupre deleted the hotfix_internal_user_cache branch May 7, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant