You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe this isn't the exect best place for bringing this up but I'm trying to understand how good_job can help me.
I have a set of jobs that operate on a same objects. I need to record the changes on another system in the exact same order they were sent in. In effect, I need to make sure that if processing a job fails in a queue, that all of the jobs behind that job in the queue would be stuck until the first one was corrected somehow.
Is there a good way to do that using good_job?
The text was updated successfully, but these errors were encountered:
@wwahammy this is an interesting challenge. I'm curious about how the sequence of operations is determined.
If I think of systems I have worked on, I would track the state of this outside of GoodJob. For example, if it was maintenance of a car:
classCarhas_many:maintenance_taskshas_many:uncompleted_maintenance_tasks,->{uncompleted.order(created_at: :asc)},class_name: "MaintenanceTask"endclassMaintenanceTaskbelongs_to:carscope:uncompleted,->{where(completed_at: nil)}endclassCarMaintenanceJob < ApplicationJobdefperform(car)task=car.uncompleted_maintenance_tasks.first# do the task, or raise an exception that would prevent the following from running...task.touch(:completed_at)CarMaintenanceJob.perform_later(car)ifcar.uncompleted_maintenance_tasks.any?endend# And the sequence of operations would be determined by calling # `car.create_maintenance_task(task_params)` for each task # that needs to be performed.
Maybe this isn't the exect best place for bringing this up but I'm trying to understand how good_job can help me.
I have a set of jobs that operate on a same objects. I need to record the changes on another system in the exact same order they were sent in. In effect, I need to make sure that if processing a job fails in a queue, that all of the jobs behind that job in the queue would be stuck until the first one was corrected somehow.
Is there a good way to do that using good_job?
The text was updated successfully, but these errors were encountered: