Skip to content

Fix generate blog blocking#226

Open
Unnati1007 wants to merge 12 commits into
vanshaggarwal27:mainfrom
Unnati1007:fix-generate-blog-blocking
Open

Fix generate blog blocking#226
Unnati1007 wants to merge 12 commits into
vanshaggarwal27:mainfrom
Unnati1007:fix-generate-blog-blocking

Conversation

@Unnati1007

Copy link
Copy Markdown
Contributor

Description

This PR resolves an issue where the /generate-blog endpoint was freezing the entire FastAPI server.

Previously, rate_code_efficiency was called synchronously on the main thread. Since it contains blocking network calls to the Gemini API and time.sleep mechanisms for rate limiting, it prevented the application from handling any other incoming requests concurrently.

This fix offloads the rate_code_efficiency executions to a background thread using await run_in_threadpool(...), similar to how generate_blog is handled. This ensures the FastAPI server remains responsive.

Related Issue

Fixes #224

Type of Change

  • Bug fix
  • New feature
  • Documentation update

Checklist

  • My code follows project guidelines
  • I have tested my changes
  • Documentation updated if needed

@Unnati1007

Copy link
Copy Markdown
Contributor Author

@vanshaggarwal27 please review the PR and merge accordingly under GSSoC'26 a bit asap please GSSoC'26 dashboard reflect progress so slow :)

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.

[BUG]rate_code_efficiency synchronously blocks the FastAPI event loop in create_blog

1 participant