favs scans backfill job

This commit is contained in:
Dylan Knutson
2025-06-27 20:27:59 +00:00
parent c74cbfe4e0
commit 5ebd924780
79 changed files with 2219 additions and 777 deletions

View File

@@ -179,12 +179,12 @@ task perform_good_jobs: :environment do
queue_name: job.queue_name,
serialized_params: job.serialized_params,
scheduled_at: job.scheduled_at,
created_at: Time.current,
updated_at: Time.current,
created_at: Time.now,
updated_at: Time.now,
process_id: SecureRandom.uuid,
)
start_time = Time.current
start_time = Time.now
# Temporarily disable concurrency limits
job_class = job.job_class.constantize
@@ -194,28 +194,28 @@ task perform_good_jobs: :environment do
begin
# Perform the job with deserialized arguments
GoodJob::CurrentThread.job = job
job.update!(performed_at: Time.current)
job.update!(performed_at: Time.now)
job_instance.arguments = deserialized_args
job_instance.perform_now
# Update execution and job records
execution.update!(
finished_at: Time.current,
finished_at: Time.now,
error: nil,
error_event: nil,
duration: Time.current - start_time,
duration: Time.now - start_time,
)
job.update!(finished_at: Time.current)
job.update!(finished_at: Time.now)
puts "Job completed successfully"
rescue => e
puts "Job failed: #{e.message}"
# Update execution and job records with error
execution.update!(
finished_at: Time.current,
finished_at: Time.now,
error: e.message,
error_event: "execution_failed",
error_backtrace: e.backtrace,
duration: Time.current - start_time,
duration: Time.now - start_time,
)
job.update!(
error: "#{e.class}: #{e.message}",
@@ -356,10 +356,11 @@ task create_post_file_fingerprints: %i[environment set_logger_stdout] do
) do |post_file|
i += 1
if i % 100 == 0
post = post_file.post
creator_str =
(post.class.has_creators? ? post.creator.to_param : "(none)")
post_desc =
"#{post_file.post.creator&.to_param&.rjust(20)} / #{post_file.post&.to_param}".ljust(
40,
)
"#{creator_str&.rjust(20)} / #{post_file.post&.to_param}".ljust(40)
puts "post_file = #{post_file.id} :: #{post_desc} - #{post_file.post.title_for_view}"
end
migrate_post_file(post_file)