Background processing + notification

I have a business need where I need the client to send a request to a server and run a process that takes a long time (say 30 mins per process, imagine generating huge pdfs here), and once it's done the client should be notified. As per my understanding of serverless, this isn't possible because there's a timeout on the lambda functions. I was wondering what solutions are common to a typical problem like this. What I had in mind was using a queue, and some kind of notification service. I have never done this before so I'd appreciate any help! TIA.
24 Replies
Choco
Choco•2y ago
i think i know one way but you need to be sure that he will not close the tab Web worker it will not block client side
shikishikichangchang
not possible. They should be allows to close the tab
Choco
Choco•2y ago
you can create a chrome extension but then they are not allow to close browser but can tab
Keef
Keef•2y ago
I wouldn't do either of those. If lambdas work for you ( 15 minute max runtime) that could be an option. If you need more time you can spin up ec2s to handle it then kill them once done. Another option would be step functions which would just let you circumvent that 15 minute limit. You can also set up a server that'll just do the processing that consumes a message queue or work queue
shikishikichangchang
How can I get lambda to work in this case?
Keef
Keef•2y ago
You'd invoke a lambda function that would handle the processing for you
shikishikichangchang
With t3 I usually just write functions
Keef
Keef•2y ago
well with vercel they have much stricter runtimes i think
shikishikichangchang
Im using AWS directly so I have 15 mins
Keef
Keef•2y ago
perfect
shikishikichangchang
do you have any tutorial that you recommend
Choco
Choco•2y ago
i didnt know you could close tabs about 15 minutes and it will proccesed 😳
Keef
Keef•2y ago
Let me dig something up Nah this kind of stuff should prob be handled on your own services for a proper user experience Thats just really it
shikishikichangchang
yeap
Keef
Keef•2y ago
and a chrome extension is just too much of a burden to get the user to use your service
shikishikichangchang
agreed Thanks keef
Keef
Keef•2y ago
A server that does thing for you is easy and lambdas are even easier tbh
shikishikichangchang
let me know what you find
Keef
Keef•2y ago
let me find a resource
Choco
Choco•2y ago
that is true, my answers arent right my bad, i think i havent read the question right then
Keef
Keef•2y ago
Nah its okay pats
Keef
Keef•2y ago
GitHub
t3-s3/src/server/aws/s3.ts at main · nramkissoon/t3-s3
Example create-t3-app with AWS S3 presigned URL integration - t3-s3/src/server/aws/s3.ts at main · nramkissoon/t3-s3
Invoke a Lambda function using an AWS SDK - AWS Lambda
Invoke a Lambda function using an AWS SDK
Keef
Keef•2y ago
I'll see if i find something more hand holding, I really just worked with aws sdk using go and you just connected to aws then invoked your functions using args And for notifications you can apply the same thing that'll send an email or whatever flavor of your notification you dream up
shikishikichangchang
ok thanks more hand holding would be nice lol
Want results from more Discord servers?
Add your server