feat(backend): implement background worker queue for processing AI feedback (fixes #317)#446
Open
Diwakar-odds wants to merge 2 commits into
Open
feat(backend): implement background worker queue for processing AI feedback (fixes #317)#446Diwakar-odds wants to merge 2 commits into
Diwakar-odds wants to merge 2 commits into
Conversation
Author
|
Hi @Canopus-Labs! 👋 I've submitted this PR to resolve issue #317 by implementing the background worker queue for AI feedback processing. 🔍 Technical Analysis (L3 Core/Architecture Justification):This PR directly tackles Core Architecture & Performance Reliability, which strongly satisfies the Level 3 criteria for the ECSoC '26 program:
Because this fundamentally upgrades the core AI feedback pipeline and introduces a scalable message-queue architecture for the resume engine, I kindly request the maintainers to review this as an L3 Contribution and apply the Looking forward to your review! 🚀 |
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.
feat(backend): implement background worker queue for processing AI feedback (fixes #317)
Summary
Migrates the synchronous AI resume analysis logic in
resumeController.jsto the BullMQ background worker queue (aiWorker.js), significantly improving API robustness and preventing HTTP request timeouts during long Gemini API calls.Motivation
Closes #317
Previously, the
analyzeResumeendpoint invoked the Gemini model synchronously. Because parsing and analyzing PDF files can take a considerable amount of time, this approach was prone to HTTP timeouts and could block the Node.js event loop. By offloading this task to the establishedaiQueue, the endpoint now responds immediately with ajobId, allowing the frontend to poll for the result. This aligns the resume analysis flow with the other AI generation pipelines in the app.Changes
backend/workers/aiWorker.js): Extracted the Gemini PDF analysis logic, prompt, and JSON parsing from the controller into a newprocessResumeAnalysisworker function. Mapped this function to the"analyze-resume"job name.backend/controllers/resumeController.js): Removed the synchronous AI logic. TheanalyzeResumeendpoint now enqueues an"analyze-resume"job with the target role and base64-encoded file buffer, returning a202 Acceptedstatus with the generatedjobId.Acceptance Criteria
Impact & Side Effects
The
analyzeResumeAPI response has changed from returning the final JSON synchronously (200 OK) to returning a job acceptance payload (202 Accepted). The frontend must use thejobIdto poll the/api/jobs/:jobIdendpoint for the final result.How to Test
POST /api/resume/analyze.jobId.GET /api/jobs/:jobIdto check the status until it returnscompletedwith the feedback JSON.Quality Checklist