Skip to content

Fix PDF loading task cleanup - #720

Open
serg33v wants to merge 2 commits into
wonderwhy-er:mainfrom
serg33v:main
Open

serg33v wants to merge 2 commits into
wonderwhy-er:mainfrom
serg33v:main

Conversation

@serg33v

@serg33v serg33v commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

pdfDocument.destroy();
doesnt exist.
correct way to use it is
pdfDocument.loadingTask.destroy();

Summary by CodeRabbit

  • Bug Fixes
    • Improved PDF image extraction cleanup to ensure document loading tasks are properly released.
    • Cleanup errors continue to be handled without interrupting extraction.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 14afb3b3-fce5-4bcf-958d-a04e7fb2ba70

📥 Commits

Reviewing files that changed from the base of the PR and between 092ce0b and 607cf50.

📒 Files selected for processing (1)
  • src/tools/pdf/extract-images.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Changes

PDF worker cleanup

Layer / File(s) Summary
Loading-task destruction
src/tools/pdf/extract-images.ts
Image extraction now unconditionally awaits pdfDocument.loadingTask.destroy() during cleanup. Cleanup errors remain ignored.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 607cf

The cleanup change matches the loading-task lifecycle contract and preserves error handling, so the PR is mergeable.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing PDF loading task cleanup.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@serg33v

serg33v commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

there is also same problem in src/tools/pdf/lib/pdf2md.ts but not clear what type is there

This branch has not been deployed

No deployments
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.

1 participant