raise on image not found
This commit is contained in:
@@ -25,7 +25,14 @@ class Domain::Fa::Job::UserAvatarJob < Domain::Fa::Job::Base
|
||||
@caused_by_entry ||= log_entry
|
||||
parser = Domain::Fa::Parser::Page.new(log_entry.response.contents, require_logged_in: false)
|
||||
@avatar.state_detail["guessed_log_entry_id"] = log_entry.id
|
||||
@avatar.file_uri = parser.user_page.profile_thumb_url
|
||||
file_url_str = parser.user_page.profile_thumb_url
|
||||
if file_url_str
|
||||
@avatar.file_uri = file_url_str
|
||||
else
|
||||
@avatar.state = :no_file_on_guessed_user_page_error
|
||||
logger.error("no user avatar found on page #{log_entry.id}")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
response = http_client.get(
|
||||
|
||||
@@ -74,31 +74,23 @@ class Domain::Fa::UserEnqueuer
|
||||
end
|
||||
|
||||
[
|
||||
"fa_user_follows",
|
||||
"fa_user_page",
|
||||
"fa_user_gallery",
|
||||
"fa_post",
|
||||
"fa_user_avatar",
|
||||
].map do |queue_name|
|
||||
GoodJob::Job.where(
|
||||
queue_name: "fa_user_follows",
|
||||
queue_name: queue_name,
|
||||
finished_at: nil,
|
||||
performed_at: nil,
|
||||
).count,
|
||||
GoodJob::Job.where(
|
||||
queue_name: "fa_user_page",
|
||||
finished_at: nil,
|
||||
performed_at: nil,
|
||||
).count,
|
||||
GoodJob::Job.where(
|
||||
queue_name: "fa_user_gallery",
|
||||
finished_at: nil,
|
||||
performed_at: nil,
|
||||
).count,
|
||||
GoodJob::Job.where(
|
||||
queue_name: "fa_post",
|
||||
finished_at: nil,
|
||||
performed_at: nil,
|
||||
).count / 5,
|
||||
GoodJob::Job.where(
|
||||
queue_name: "fa_user_avatar",
|
||||
finished_at: nil,
|
||||
performed_at: nil,
|
||||
).count,
|
||||
].max
|
||||
error: nil,
|
||||
).where(
|
||||
[
|
||||
"(serialized_params->'exception_executions' = '{}')",
|
||||
"(serialized_params->'exception_executions' is null)",
|
||||
].join(" OR ")
|
||||
).count
|
||||
end.max
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class Domain::Fa::UserAvatar < ReduxApplicationRecord
|
||||
},
|
||||
)
|
||||
|
||||
enum :state, [:ok, :download_error]
|
||||
enum :state, [:ok, :download_error, :no_file_on_guessed_user_page_error]
|
||||
after_initialize do
|
||||
self.state ||= :ok
|
||||
self.state_detail ||= {}
|
||||
|
||||
Reference in New Issue
Block a user