blitz-js / legacy-framework

MIT License
2 stars 2 forks source link

Query/Mutation timeout? #156

Closed ospfranco closed 2 years ago

ospfranco commented 2 years ago

What do you want and why?

I have a long-running mutation that takes a while to do its job, it crawls and sends emails to a bunch of users, that is triggered via cron job (I'm using express). This works fine on local, but in my production environment it is a bit too slow and it looks like the mutation terminates before the job is done and all the users have been processed.

Is it possible to change the time-out of a mutation/query? I'm also using express so do I also need to change it there?

Possible implementation(s)

Expose the mechanism to handle the timeouts, either on an individual mutation level or a global level. Also, what happens if the app is running on a custom server.ts

beerose commented 2 years ago

Hey @ospfranco!

When it comes to setting timeouts, I think the place to do it is your hosting provider.

However, I'd suggest using a tool for background processing — this way you'll get rid of some of these problems. You can check out these two: https://github.com/OptimalBits/bull, https://github.com/jbielick/faktory_worker_node.