We would like to implement the following batch processing.
However, it is not a regular thing like once a day, but only when a request is made.
Therefore, on many days, batch processing may run five times a day, or on the contrary, it may not run once a day.
Enter the date and time you want to run from the screen and submit a request ↓ Batch processing starts at that time of day
To achieve periodic batch processing in Rails
whenever seemed good.
However, as mentioned above, I was not sure what kind of design I should use to achieve irregular batch processing.
Also, I thought about how to register with cron every hour to check if there is a request or not, but I think it's not a very good design, so if there's any other good way, I'd like to design based on it.
Thank you for your cooperation.
以下 I would like to make it happen with the following image.
#params[:batch_requests] contains multiple dates and times every params [:batch_requests] do rake'my:rake:task' end
Also, I have a question for you.
Thank you for your understanding.
I would use ActiveJob.
As an image, this is what it looks like.
class BatchController <ApplicationController def create(batch_at) BatchJob.set(wait_until:batch_at).perform_later end end
Since whenever is cron, I don't think it's suitable for irregular execution, but I wonder what it is like.
371 Update Flask User Information
356 I want to create an array of sequences from "1" to a specified number.
345 Who developed the "avformat-59.dll" that comes with FFmpeg?
339 Scrap text information after the "View More" button when searching in the Yahoo! News search window
© 2023 OneMinuteCode. All rights reserved.