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

Proposal: the update of User lastSeenAt & lastVisitAt in auth middleware should be optimized #83

Open
yunge opened this issue May 10, 2024 · 3 comments

Comments

@yunge
Copy link

yunge commented May 10, 2024

In auth middleware, the update of User lastSeenAt & lastVisitAt is too frequent, it's better to "update after a certain amount of time past the old timestamp".

Unnecessary updates can affect postgres performance and generate unnecessary WAL logs.

And the code is in "backend/src/middlewares/guard/auth.ts", thanks.

@flipvh
Copy link
Contributor

flipvh commented May 12, 2024

You are right. For counts in a high concurrency scenario we need a better count strategy altogether perhaps. Not directly on the user perhaps. This is an almost universal challenge, so I am sure that there exist smart solutions to have scalable counts that are almost realtime or eventually consistent? Perhaps an open source event analytics library can help cella to also maintain county like these? For example, I am following this repo: https://github.com/Openpanel-dev/openpanel . What do you think?

@flipvh
Copy link
Contributor

flipvh commented May 12, 2024

benefit of such a strategy is that it can help with both app-level reporting as well as customer/tenant-level and perhaps product/project level reporting, ideally all from within the app/cella itself. cc @yunge

@yunge
Copy link
Author

yunge commented May 13, 2024

It's nice to have a more professional service, but I'd recommend keeping a basic functionality based on our own DB server.

After all, not everyone needs a professional service(such as in-house systems). In addition, Openpanel’s GPL license may also cause some troubles.

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

No branches or pull requests

2 participants