less logging in scan post job

This commit is contained in:
Dylan Knutson
2023-04-16 15:33:23 -07:00
parent 75503e2a99
commit 158fb9b478
3 changed files with 15 additions and 21 deletions

View File

@@ -8,9 +8,7 @@ class Domain::Fa::Job::ScanPostJob < Domain::Fa::Job::Base
end
@caused_by_entry = args[:caused_by_entry]
@force_scan = !!args[:force_scan]
logger.prefix = "[fa_id #{@post.fa_id.to_s.bold} / #{@post.state.bold}]"
logger.info "start scan, triggered by #{@caused_by_entry&.id}"
logger.prefix = proc { "[fa_id #{@post.fa_id.to_s.bold} / #{@post.state.bold}]" }
if @post.state == "ok" && !@post.scanned? || @force_scan
if (@post.state_detail["404_count"] || 0) > 2

View File

@@ -42,23 +42,21 @@ class Domain::Fa::PostEnqueuer
end
measure("enqueue jobs") do
bulk_enqueue_jobs do
rows.each do |post_id, fa_id, file_url_str|
if file_url_str.nil?
Domain::Fa::Job::ScanPostJob.perform_later({ fa_id: fa_id })
action = "page scan"
else
Domain::Fa::Job::ScanFileJob.perform_later({ fa_id: fa_id })
action = "file scan"
end
if post_id.nil?
model_info = "(not seen)"
else
model_info = "post #{post_id.to_s.bold}"
end
logger.info "[#{action}] [#{model_info}] (fa_id: #{fa_id.to_s.bold})"
rows.each do |post_id, fa_id, file_url_str|
if file_url_str.nil?
Domain::Fa::Job::ScanPostJob.perform_later({ fa_id: fa_id })
action = "page scan"
else
Domain::Fa::Job::ScanFileJob.perform_later({ fa_id: fa_id })
action = "file scan"
end
if post_id.nil?
model_info = "(not seen)"
else
model_info = "post #{post_id.to_s.bold}"
end
logger.info "[#{action}] [#{model_info}] (fa_id: #{fa_id.to_s.bold})"
end
end
raise StopIteration if rows.empty?

View File

@@ -28,7 +28,6 @@ class Domain::Fa::UserEnqueuer
end
end
measure("enqueue jobs") do
# bulk_enqueue_jobs do
rows.each do |user|
types = []
if user.state == "ok"
@@ -56,7 +55,6 @@ class Domain::Fa::UserEnqueuer
logger.info "#{types} - #{user.url_name.bold} - #{user.id.to_s.bold}"
end
end
# end
throw StopIteration if rows.empty?
else
logger.info(