-
Notifications
You must be signed in to change notification settings - Fork 2
Improve performance and make JWT auth non-blocking #59
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @tekrajchhetri, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the performance and scalability of the JWT authentication system by transforming blocking operations into non-blocking asynchronous calls. By leveraging Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request is a great step forward in making the JWT authentication logic fully non-blocking. The use of asyncio.to_thread for CPU-bound tasks like password hashing is correctly implemented, and the switch to an async with context manager for database connections significantly improves resource management. My review focuses on a potential race condition in the user registration flow and suggests adding return type hints to enhance code clarity and maintainability. Overall, these are excellent changes that improve the application's performance and robustness.
…o support scalability
This pull requests updates the code to make it async/non-blocking to address the following issue sensein/brainkb-ui#101.
Test System
Apple M3 Pro/36GB RAM/12 Cores
MLService Test
Total requests: 5000 with 100 concurrent requests
Success (2xx): 4982 (99.64%)
Failures: 18 (0.36%)
Latency ms: min=19.83 avg=3533.93 max=10118.82 p50=3510.18 p90=4259.24 p95=4506.85 p99=5305.97
Status counts:
200: 4982
NO_STATUS: 18
Test results:




Queryservice
Total requests: 5000
Success (2xx): 5000 (100.00%)
Failures: 0 (0.00%)
Latency ms: min=655.10 avg=3402.47 max=8468.60 p50=3358.82 p90=4232.98 p95=4568.08 p99=5212.95
Test results:



