-
Notifications
You must be signed in to change notification settings - Fork 100
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
Removing jobs from the solid_queue_jobs table? #153
Comments
No, as the polling and claiming applies to About what would happen, it'd depend on when it gets deleted and whether you have this foreign key in your DB: add_foreign_key :solid_queue_claimed_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade which is added by the default migration. Here's the relevant code that handles job processing, part of ClaimedExecution: def perform
result = execute
if result.success?
finished
else
failed_with(result.error)
end
ensure
job.unblock_next_blocked_job
end
private
def execute
ActiveJob::Base.execute(job.arguments)
Result.new(true, nil)
rescue Exception => e
Result.new(false, e)
end
def finished
transaction do
job.finished!
destroy!
end
end
def failed_with(error)
transaction do
job.failed_with(error)
destroy!
end
end If the deletion is committed before the ActiveJob::Base.execute(job.arguments) it won't get to run as
However, another exception will be raised when calling job.unblock_next_blocked_job but it'll also fail because The claimed execution would have been deleted with the job via the foreign key if you have that defined. If not, the claimed execution will be left behind and will be cleared up when the process that owned it is terminated. If the deletion is committed after the def finished
transaction do
job.finished!
destroy!
end But the two queries from UPDATE `solid_queue_jobs` SET `solid_queue_jobs`.`updated_at` = '...', `solid_queue_jobs`.`finished_at` = '...' WHERE `solid_queue_jobs`.`id` =..
DELETE FROM `solid_queue_claimed_executions` WHERE `solid_queue_claimed_executions`.`id` = .. won't do anything because the job and the claimed execution would be gone from the database (the claimed execution would have been deleted with the job via the foreign key). If you didn't have the foreign key, then the claimed execution will get deleted there. If the deletion is committed after the |
Hi,
Hopefully a simple question - what would happen if you remove a job intentionally that was just picked up for processing?
If you apply a lock on the row before removing it, would that prevent solid_queue from working on it?
The text was updated successfully, but these errors were encountered: