You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Search service _rate_limit blocks async event loop with time.sleep #158
Search service _rate_limit blocks async event loop with time.sleep
Severity: High File:backend/app/services/search_service.py:139
The _rate_limit method uses synchronous time.sleep() to enforce rate limiting for Semantic Scholar API calls. When called from async FastAPI endpoints, this blocks the entire event loop, preventing other requests from being processed during the sleep period.
def_rate_limit(self):
"""Ensure we don't exceed rate limits."""elapsed=time.time() -self.last_request_timeifelapsed<self.min_request_interval:
time.sleep(self.min_request_interval-elapsed)
self.last_request_time=time.time()
Why it matters
Concurrent idea generation sessions or literature searches will queue up and experience degraded performance. A single slow search can block the entire backend for 3+ seconds.
Activity