remove delayed_job, use structure.sql

This commit is contained in:
Dylan Knutson
2025-01-27 17:05:25 +00:00
parent e2e75cdc3d
commit 1cbc94b43c
5 changed files with 7019 additions and 1894 deletions

View File

@@ -100,34 +100,6 @@ task good_job: %i[environment set_ar_stdout set_logger_stdout] do
exec(cmd)
end
task recompute_job_signatures: :environment do
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger.level = :error
start_at = ENV["start_at"]&.to_i || 0
count = 0
destroyed = 0
puts "# jobs: #{Delayed::Job.count}"
Delayed::Job.find_each(start: start_at) do |job|
job.set_signature
unless job.save
job.destroy
destroyed += 1
end
count += 1
if count % 50 == 0
puts "processed #{count}, destroyed #{destroyed} - last id: #{job.id}"
end
end
end
task workoff_failed_jobs: %i[environment set_ar_stdout set_logger_stdout] do
worker = Delayed::Worker.new
Delayed::Job
.where("last_error is not null and attempts <= 2")
.find_each(batch_size: 1) { |job| worker.run(job) }
end
task :reverse_csv do
file = ENV["file"] || raise("need 'file' (file path)")
in_csv = CSV.parse(File.open(file, "r+"), headers: true)