-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat/extract) Move extract to a queue system #1044
Conversation
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: apps/api/src/lib/extract/extraction-service.ts
📄 File: apps/api/src/services/queue-worker.ts (Click to Expand)
Did you find this useful? React with a 👍 or 👎 |
This uses a different queue but we can merge it to be on 1 queue only if preferred @mogery |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest is good. Though I think right now while it's in progress it will just return Job not found, which is suboptimal.
const rateLimiter = scrapeStatusRateLimiter; | ||
const incomingIP = (req.headers["x-forwarded-for"] || | ||
req.socket.remoteAddress) as string; | ||
const iptoken = incomingIP; | ||
await rateLimiter.consume(iptoken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this here? This is handled by the authMiddleware.
req: RequestWithAuth<{ jobId: string }, any, any>, | ||
res: Response, | ||
) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must not wrap v1 endpoint controllers in a try-catch. Error handling is done on the Express middleware level.
const job = await supabaseGetJobByIdOnlyData(req.params.jobId); | ||
if (!job || job.team_id !== req.auth.team_id) { | ||
return res.status(403).json({ | ||
success: false, | ||
error: "You are not allowed to access this resource.", | ||
}); | ||
} | ||
|
||
const jobData = await supabaseGetJobsById([req.params.jobId]); | ||
if (!jobData || jobData.length === 0) { | ||
return res.status(404).json({ | ||
success: false, | ||
error: "Job not found", | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why request the DB twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meant to RC not approve
Wrong branch, will fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
No description provided.