3 ms·
Do scheduling tools in a web framework protect you from having to write threading code yourself? Or is it for a completely separate kind of side-process than wh
by barnaby 16y ago
Do scheduling tools in a web framework protect you from having to write threading code yourself? Or is it for a completely separate kind of side-process than when I would want to write threads in my web app code?
Also, is that like Quarts in the Spring Framework?
- steveklabnik 16y ago> Or is it for a completely separate kind of side-process than when I would want to write threads in my web app code? This isn't about threading, really. I'll explain it in terms of Rails's delayed_job because I'm not familiar with the details of Celery: * Let's say I want to send an email, via the function Mailer.deliver_notice(email) * With delayed_job, I turn this call into Mailer.delay.deliver_notice(email). This puts an entry into a Jobs table in the database that makes note of what I want to run, with all the details. * In the background, I have a daemon running that checks the Jobs table every five seconds for jobs that need to be run. It uses the information in the table to execute the deliver_notice function. * That's it. In many cases, the job will update some sort of field in your model that you can query to see if it's been run yet or not.