-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to schedule many instances of a recurring task with different args #216
Comments
zavan
changed the title
A way to batch schedule recurring tasks
A way to schedule many instances of a recurring task
May 1, 2024
zavan
changed the title
A way to schedule many instances of a recurring task
A way to schedule many instances of a recurring task with different args
May 1, 2024
Hey @zavan! Yes, I think that'd be the way 🤔 Perhaps if I had more cases like class RunnerJob < ApplicationJob
def perform(command)
eval(command)
end
end recurring_tasks:
update_customer_stats:
class: "RunnerJob"
schedule: "every 3 hours"
args: "UpdateCustomerStatsJob.enqueue_all" but if it's only one case, I'd go with your solution, I think. |
Hello, I agree with @rosa, take a look at the configuration of simple_scheduler is very simple and clear. https://github.com/simplymadeapps/simple_scheduler |
I will go that route. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been using the
whenever
gem to do something like for a lot of my recurring jobs:I wanted to use solid_queue recurring tasks to do this. However since it only allows passing a job class on which it always calls
perform_later
, if I want to do this I think I have to create a separate job responsible solely for enqueuing the individual jobs:Do you think there could be a simpler way to do this with solid_queue? I guess the difficult part would be to avoid duplicate jobs in case of multiple dispatchers (for 'whenever' I only run it on one host right now and I use 'activejob-uniqueness'). Not sure how it could handle doing things in batches also (I'm thinking I don't want to create hundreds of thousands of job instances in memory before enqueuing them), maybe some
yield
ing mechanism.I don't know if it's just me doing things this way or if it could be useful for more people, but I guess that's the only way to know :)
The text was updated successfully, but these errors were encountered: