fix: resolve stuck Next.js ingestion queue jobs - #55
Open
Akshatshukla-25 wants to merge 1 commit into
Open
Conversation
|
🎉 Thanks for submitting a PR, @Akshatshukla-25! Please confirm the following checklist before review:
A maintainer will review your PR shortly. Thank you! 🚀 |
Author
|
Owner
|
You didn't read contribution guidelines, please follow guidelines |
Owner
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: Describe your changes
This PR resolves the stuck Next.js ingestion queue jobs issue by implementing a global singleton pattern for the server runtime, triggering the queue worker properly in
drainQueue, and passing job IDs to update pipeline stages in real time.Issue ticket number and link
Closes #41
Changes
src/server/runtime.tsto implement aglobalThissingleton for all runtime services (queue, pipeline, repository, vector index, processed storage, and worker). This ensures that separate Next.js route bundles/compilations share the exact same state in memory.drainQueueinsrc/server/runtime.tsto callworker.trigger()instead of manually invokingpipeline.process, which bypassed the queue's internal list (this.order).src/server/services/workers/queueWorker.tsto passjob.idtopipeline.process(job.payload, job.id), enabling status and stage updates (likeocr,vision,tagging) to be recorded on the queue and rendered live in the UI dashboard.Testing
npm run dev.curl -X POST -F "file=@public/logo.png" -F "sourceType=local" http://localhost:3000/api/screenshots.QueueWorkerpicked up and successfully completed processing./api/screenshots/<jobId>to verify status transitions to"processed".npm run backend:check(successful).Checklist before requesting a review
.envvalues are committed