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(core): disable lastLogin update as an option #3253

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alexisvigoureux
Copy link
Contributor

Description

Disable the last login update (prevent a save on user entity) when a user logs in.

Breaking changes

No

Screenshots

context: our users need to be authenticated to view our products.
We receive a lots of request on the authenticate endpoint, and we have a bottleneck on this endpoint.

When we have too much traffic, we have locks on the ‘user’ table

Capture d’écran 2024-11-29 à 15 47 49 Capture d’écran 2024-11-29 à 15 48 16

Here is the request UPDATE "user" SET "lastLogin" = $1, "updatedAt" = CURRENT_TIMESTAMP WHERE "id" IN ($2)
This query is not useful for us. This PR proposes a solution to deactivate it and avoid a lock on the user table.
In terms of volume, this represents more than 250k updates of the lastLogin field per day, often at the same connection time.

Not sure where to write the tests, please let me know.

Checklist

📌 Always:

  • I have set a clear title
  • My PR is small and contains a single feature
  • I have checked my own PR

👍 Most of the time:

  • I have added or updated test cases
  • I have updated the README if needed

Copy link

vercel bot commented Dec 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Dec 2, 2024 11:08am

@alexisvigoureux alexisvigoureux marked this pull request as ready for review December 2, 2024 11:07
Copy link

sonarcloud bot commented Dec 2, 2024

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