fix: timeout issues#223
Conversation
Summary of ChangesHello @NotYuSheng, 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 addresses and resolves various timeout-related issues across the application by fine-tuning HTTP client configurations, enhancing job status polling, and optimizing backend processing parameters. The changes aim to improve the reliability and user experience when handling large or complex PDF documents that require extended processing times, ensuring that operations complete successfully without premature interruptions. Highlights
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
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
There was a problem hiding this comment.
Code Review
This pull request refactors the frontend HTTP client handling to address timeout issues. It removes the global httpx client in favor of creating them within functions with specific timeouts for different operations like file uploads and status polling. The frontend polling loop has also been changed to run indefinitely, relying on backend status or client timeouts instead of a fixed number of attempts. These are good changes that should improve robustness.
My review focuses on a critical resource management issue introduced in the refactoring of process_pdf where HTTP clients might not be closed properly in case of an error, potentially leading to resource leaks and application crashes. I've provided a suggestion to fix this.
PR Type
Bug fix, Enhancement
Description
Fix timeout issues with HTTP client configuration
Remove settings page and update UI elements
Improve error handling and logging
Optimize image scaling and status responses
Diagram Walkthrough
File Walkthrough
main.py
Update UI elements and remove settingsfrontend/main.py
main.py
Enable debug logging for doclingpdf_extraction_service/main.py
extractor.py
Optimize image scaling and status responsespdf_extraction_service/routers/extractor.py
1_upload_UI.py
Fix timeout issues with HTTP clientsfrontend/my_pages/1_upload_UI.py
caption.py
Add timeout config for caption servicepdf_extraction_service/utils/caption.py