From b389fe3e23037f26a9d1d63e78c08890c65c3d22 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 23:36:05 +0000 Subject: [PATCH] Offload bcrypt crypto operations to threadpool in auth.py Offloads `bcrypt.hashpw` and `bcrypt.checkpw` in `backend/auth.py` to `starlette.concurrency.run_in_threadpool`. Changes `verify_password` and `get_password_hash` to be `async def`. This prevents CPU-bound crypto tasks from blocking the event loop when processing `register`, `login`, and `setup_initial_admin` endpoints, improving concurrency and throughput. Co-authored-by: benpiper <4343814+benpiper@users.noreply.github.com> --- .jules/bolt.md | 3 +++ backend/auth.py | 12 +++++++----- backend/main.py | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index e6d39e6..1768cd2 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -16,3 +16,6 @@ ## 2024-06-28 - Optimize array lookups in high-frequency React event handlers **Learning:** Even if data is pre-processed/memoized (like cached `parsedTimestamps`), performing an O(N) linear search on that array inside a high-frequency event handler (like `