Skip to content

Parse uploaded files one at a time so large PDF batches don't time out - #62

Merged
ronnyTodgers merged 1 commit into
masterfrom
fix/sequential-pdf-parse
Sep 4, 2026
Merged

Parse uploaded files one at a time so large PDF batches don't time out#62
ronnyTodgers merged 1 commit into
masterfrom
fix/sequential-pdf-parse

Conversation

@ronnyTodgers

Copy link
Copy Markdown
Collaborator

Fixes #61.

Problem

Uploading many large PDFs sends them all in one /text/parse call. Tika can take well over a minute per big or scanned PDF, the client aborts at 15 s, and the retry loop then re-sends the whole batch twice more while the server is still working on the first attempt. The user sees "Something went wrong" although each file parses fine on its own (as Thomas confirmed by uploading them one by one).

Fix

  • Upload.js: after reading the files locally, call /text/parse once per file, in series. A progress toast shows Parsing 3 of 15: name.pdf, each file appears in the editor as soon as it lands, and the final toast lists any files that failed rather than failing the whole batch.
  • DataContext.js: parse() takes a per-file timeout (180 s) and no longer retries — re-sending a PDF that just timed out only piles more work on the server. retryablePostData gains a retries option (default unchanged at 3) so nothing else changes.

The API caches parsed files by content hash, so re-uploading an already-parsed file is instant.

Notes

  • Same change is going into the consolidated meta app (harmonydata/meta) for /harmony.
  • Server side is untouched; sequential calls keep each request inside the proxy timeouts, which is what the issue asks for.

🤖 Generated with Claude Code

A single /text/parse call carrying many large PDFs times out: Tika can
take well over a minute per big or scanned PDF, and the client's 15s
timeout with three blind retries then re-sent the whole batch while the
server was still working on the first attempt. The user saw "Something
went wrong" even though each file parses fine on its own.

Upload.js now chains one /text/parse call per file, in series, with a
progress toast ("Parsing 3 of 15: name.pdf"), shows each file as soon as
it lands, and reports which files failed instead of failing the batch.
DataContext.parse gets a generous per-file timeout and no retry, since
re-sending a PDF that just timed out only piles more work on the server.
The API caches parsed files by content, so a re-upload is instant.

Fixes #61

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for harmony-staging ready!

Name Link
🔨 Latest commit 764b401
🔍 Latest deploy log https://app.netlify.com/projects/harmony-staging/deploys/6a9aabe4ee3d9e0008659e9f
😎 Deploy Preview https://deploy-preview-62--harmony-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@ronnyTodgers
ronnyTodgers merged commit 5436fed into master Sep 4, 2026
5 checks passed
@ronnyTodgers
ronnyTodgers deleted the fix/sequential-pdf-parse branch September 4, 2026 15:39
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.

When user uploads multiple large PDFs, the API times out - can we do it one by one?

1 participant