Cron Jobs Duration
ameeth05
HOBBYOP

2 months ago

Hey everyone!!

I'm prototyping a data pipeline app: a Python backend that scrapes Instagram posts, hashtags, and comments using Apify actors. It then runs sentiment analysis on the data with LLMs, saves everything to a SQLite DB, and I've got a separate Svelte frontend to pull and display the results.

The goal is to automate this whole flow to run once a day, say at midnight UTC. Right now, I don't have a solid benchmark on how long it'll take—could be a quick 30 mins if things are light, or stretch to 2-4 hours if the scrapes hit rate limits or the analysis gets heavy with more data.

From the docs, cron jobs look promising: no hard timeout, meant for tasks that finish and exit cleanly, skips overlaps (not an issue daily), and 5-min min interval. But I wanted to check with folks who've done similar: Would a potentially long job like this run reliably without getting killed, surprise bills piling up, or just getting skipped? Any gotchas with resource handling over extended periods?

If crons aren't the move for something this variable, what other Railway features could I lean on? Like job queues, background workers, or hooking into external schedulers via webhooks? Open to any tips to make this workflow play nice here.

Happy to share more info on the setup if that helps. Thanks a ton!!

$10 Bounty

4 Replies

Railway
BOT

2 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


irazvan2745
PRO

2 months ago

Crons should be perfect for your app


tonkotsu
PRO

2 months ago

I've recently been working on a project that was on a CRON schedule for every 6 hours. Depending on the backlog of data that my scripts had to go through, it could take upwards of 8 hours to complete (with average times of 5-10 minutes once it's caught up). I had zero issues...

...save for a scalability concern.

In my case, my script was built out to only support one tenant per-instance, so I'd have to spin up multiple instances on Railway to support everything I needed. I ended up migrating from the CRON jobs to a scheduler and queue system: a scheduler program that runs every 5 minutes (CRON) to check for overdue tasks and push them to a queue, then another program that's constantly running and has workers listen to and handle jobs in the queue. This ended up working for my use case better than separate instances. Just something to keep in mind!


ameeth05
HOBBYOP

2 months ago

Thanks for the response guys! Really helpful


Loading...