Skip to content

Respect abort signals in asset preprocessing worker#2179

Open
MohamedBassem wants to merge 1 commit intomainfrom
codex/fix-asset-pre-processing-worker-abort-signals
Open

Respect abort signals in asset preprocessing worker#2179
MohamedBassem wants to merge 1 commit intomainfrom
codex/fix-asset-pre-processing-worker-abort-signals

Conversation

@MohamedBassem
Copy link
Collaborator

Summary

  • ensure the asset preprocessing worker's OCR and PDF text extraction honor abort signals
  • make PDF screenshot generation abortable and propagate abort errors instead of swallowing them
  • guard the worker loop with abort checks before intensive operations

Testing

  • pnpm --filter @karakeep/workers typecheck

Codex Task

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Warning

Rate limit exceeded

@MohamedBassem has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 24 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6821257 and 31636d9.

📒 Files selected for processing (1)
  • apps/workers/workers/assetPreprocessingWorker.ts (14 hunks)

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 and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +117 to +120
const ret = await Promise.race([
worker.recognize(buffer),
abortPromise(abortSignal),
]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent abort race from causing unhandled rejection

In readImageText the abort handling races worker.recognize against abortPromise, but the abort promise is left pending when OCR wins the race. If the job’s abort signal fires later (e.g., the queue timeout or a manual cancellation after OCR completed), that pending promise will reject with no catch handler, producing an unhandled rejection and potentially taking down the worker process under Node’s default unhandledRejection behavior; the same pattern also exists in the PDF screenshot race. The abort promise needs to be cancelled or observed so late aborts don’t crash the worker.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant