Skip to content

feat: add real-time file processing progress indicators with async polling#214

Open
rajesh-puripanda wants to merge 2 commits into
Durgeshwar-AI:mainfrom
rajesh-puripanda:feat/async-progress-indicators
Open

feat: add real-time file processing progress indicators with async polling#214
rajesh-puripanda wants to merge 2 commits into
Durgeshwar-AI:mainfrom
rajesh-puripanda:feat/async-progress-indicators

Conversation

@rajesh-puripanda

Copy link
Copy Markdown
Contributor
  • Add in-memory JobRegistry for async job progress tracking
  • Add /api/status/<job_id> and /api/download/<job_id> endpoints
  • Refactor removeBg, merge-pdf, compress, upscale to async with polling
  • Create animated ProgressBar component with status colors
  • Create useJobPolling hook (500ms interval)
  • Update ToolPageTemplate with useAsyncProgress prop
  • Add progress indicators to RemoveBg, ImageCompress, ImageUpscale, PdfMerge
  • Fix dead duplicate code in compress route

🔀 Pull Request

📌 Issue Reference

Closes #84


📝 Summary

Problem: File operations like background removal, PDF merge, image compression, and upscaling took noticeable time with only a spinner for feedback. Users had no visibility into processing progress.

Solution: Implemented an in-memory JobRegistry with async background processing. The backend returns a job_id immediately (HTTP 202), the frontend polls /api/status/<job_id> every 500ms, and an animated ProgressBar displays real-time progress (percentage + status messages) until completion, when the result auto-downloads.

Major changes:

  • Backend — New JobRegistry singleton (thread-safe), new /api/status/ and /api/download/ endpoints, refactored removeBg, merge-pdf, compress, and upscale routes to async with staged progress updates
  • Frontend — New ProgressBar component (animated, color-coded), new useJobPolling hook, updated ToolPageTemplate with useAsyncProgress prop, integrated into 4 pages

✅ Checklist

  • My code follows the project's coding conventions
  • I have tested all impacted features
  • I have updated or added necessary documentation

💬 Additional Notes

  • Backward compatible: all other routes remain synchronous, pages without useAsyncProgress={true} behave identically to before
  • Fast routes (WebP, JPEG, grayscale, resize, DPI, metadata, split, rotate) are untouched
  • Custom onSubmit handlers (PdfPng client-side, ImageOCR, ImageToSVG) continue to work unchanged
  • Dead duplicate code in the old compress route was removed
  • Pre-existing frontend lint errors across the repo have been resolved

- Add in-memory JobRegistry for async job progress tracking
- Add /api/status/<job_id> and /api/download/<job_id> endpoints
- Refactor removeBg, merge-pdf, compress, upscale to async with polling
- Create animated ProgressBar component with status colors
- Create useJobPolling hook (500ms interval)
- Update ToolPageTemplate with useAsyncProgress prop
- Add progress indicators to RemoveBg, ImageCompress, ImageUpscale, PdfMerge
- Fix dead duplicate code in compress route
- Remove unused variable in PdfSplit (max)
- Remove unused useOutletContext import in ImageWatermark
- Remove unused areValidDimensions function in ImageResize
- Remove unused catch binding in ImageOCR
- Remove unused file param in ImageMetadata
- Remove unused error param in ErrorBoundary
- Wrap addFiles in useCallback and fix onDrop deps in PdfMerge
- Remove unused downloadTriggered state in ToolPageTemplate
- Remove unused useState import and handleNavClick in LandingPage
@rajesh-puripanda

Copy link
Copy Markdown
Contributor Author

@Durgeshwar-AI This PR is ready for review!

The implementation includes:

  • Backend: In-memory JobRegistry + /api/status/<job_id> + /api/download/<job_id> endpoints
  • Frontend: Animated ProgressBar component with gradient fill, pulse animation, and green/red/blue status colors + useJobPolling hook that polls every 500ms
  • 4 routes refactored to async with staged progress: removeBg, merge-pdf, compress, upscale
  • Backward compatible other routes untouched, custom onSubmit handlers unchanged
  • Pre-existing frontend lint errors resolved for clean CI

Could you please add the appropriate labels?

  • critical / high-priority
  • backend & frontend
  • clean-code / well-structured if applicable

Also, I can provide a screen recording of the progress bar in action would you like me to record one and share it here?

Let me know if any changes are needed!

@rajesh-puripanda

Copy link
Copy Markdown
Contributor Author
01-initial-page 02-file-selected 03-processing-1 03-processing-2 03-processing-3 03-processing-4 03-processing-5 04-completed progress_demo

@rajesh-puripanda

Copy link
Copy Markdown
Contributor Author

Attaching images for your reference!!

@Durgeshwar-AI

Copy link
Copy Markdown
Owner
Screen.Recording.2026-06-04.121120.mp4
Screen.Recording.2026-06-04.121323.mp4

The first one is from the current main branch and the second one is what you have changed. Please check.
@rajesh-puripanda

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.

Add Real-Time File Processing Progress Indicators

2 participants