specs for user favs scanning

This commit is contained in:
Dylan Knutson
2025-02-19 20:37:22 +00:00
parent 44209ac89b
commit d8eadfd416
25 changed files with 7018 additions and 212 deletions

View File

@@ -225,6 +225,16 @@ task fix_buggy_fa_posts: :environment do
end
end
task enqueue_fa_posts_missing_files: %i[environment set_logger_stdout] do
Domain::Post::FaPost
.where(state: "ok")
.where
.missing(:file)
.find_each(order: :desc) do |post|
Domain::Fa::Job::ScanPostJob.perform_later(post:)
end
end
task fix_e621_post_files: :environment do
query = Domain::Post::E621Post.where(state: "ok").where.missing(:files)
limit = ENV["limit"]&.to_i
@@ -253,7 +263,15 @@ task perform_good_jobs: :environment do
relation =
if job_id
GoodJob::Job.where(id: job_id)
job =
GoodJob::Job.find_by(id: job_id) ||
GoodJob::Execution.find_by(id: job_id)&.job
if job.nil?
puts "no job found with id #{job_id}"
exit 1
end
puts "found job with id #{job.id}" if job.id != job_id
GoodJob::Job.where(id: job.id)
else
GoodJob::Job.queued.where(job_class: job_class).order(created_at: :asc)
end