Back to articles
How Background Jobs Actually Work in Rocket.Chat — A Deep Dive into Agenda

How Background Jobs Actually Work in Rocket.Chat — A Deep Dive into Agenda

via Dev.to WebdevAshwani Yadav

You know that feeling when you look at an open source codebase for the first time and think, "Wow, this is massive, where do I even start?" That's exactly how I felt when I started exploring Rocket.Chat . I was curious about one specific thing: how does Rocket.Chat handle background tasks? Things like cleaning up old files, syncing users from LDAP, sending scheduled reports — all the stuff that happens behind the scenes while you're busy chatting. Turns out, the answer is a library called Agenda , and how Rocket.Chat uses it taught me a lot more than I expected. Why not just use setInterval ? This was my first question. Node.js already has setInterval . Why bring in a whole library? Think about it: Server crashes? Your setInterval is gone. The job never runs again until someone manually restarts things. Running multiple instances? Great, now the same job runs 3 times simultaneously on 3 different servers. That's not a feature, that's a bug. No history? Good luck figuring out when somet

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles