Single endpoint that can take up to few minutes to resolve

I have my whole backend on nextjs api routes. Everything works great, but right now I need the backend to have an endpoint that can take up to few minutes to resolve, mostly because of calling gpt API, should I go with lambda function or seperate micro service? Are there any other alternatives? What would you do in that scenario? Thx
2 Replies
Sturlen
Sturlen16mo ago
I'd look into using queues instead of stopping everything and waiting on a response. this article might explain it a bit better https://fin-techology.medium.com/system-design-interview-prep-how-to-handle-long-running-job-asynchronously-with-long-polling-34d8b2a890e1
Medium
System Design Interview Prep: How to Build a System to Handle Long ...
How do you design a Youtube or a Netflix? Have you ever wondered how to build a system that handle long running task like uploading and…
Jaaneek
Jaaneek16mo ago
So you are suggesting a microservice then? I would prefer more precise answer, here to host it? Which technologies would you use?
Want results from more Discord servers?
Add your server