Answer the question
In order to leave comments, you need to log in
Why is CRON slowing down the entire site for all users?
It is necessary to update something on the site for all records of one table on a schedule.
Created a CRON task for this. In fact, this task consists in the fact that the server executes wget on a schedule, stupidly follows the link to the desired controller and action.
This action has a loop that iterates through all the records and updates them as needed. Since there are a lot of records, I decided to make an interval between updates using sleep(30)
. And this is what slows down the site for all users.
Why is that? It turns out that sleep in Ruby is similar to sleep in bash, which means that there is a delay of 30 seconds for the entire Rails project.
How do you implement spacing in a Rails loop?
Answer the question
In order to leave comments, you need to log in
You will be busy, just one worker, which is actually fundamentally wrong, why not call this update without a server, according to the task.
UPD:
For example whenever
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question