only enqueue scan post job if new record

This commit is contained in:
Dylan Knutson
2025-02-03 19:41:16 +00:00
parent bcd845759e
commit fc8e74d2fb
3 changed files with 8 additions and 7 deletions

View File

@@ -156,10 +156,12 @@ class Domain::Fa::Job::FavsJob < Domain::Fa::Job::Base
submission_parser_helper,
first_seen_log_entry: response.log_entry,
)
post.enqueue_job_after_save(
Domain::Fa::Job::ScanPostJob,
{ post:, caused_by_entry: causing_log_entry },
)
if post.new_record?
post.enqueue_job_after_save(
Domain::Fa::Job::ScanPostJob,
{ post:, caused_by_entry: causing_log_entry },
)
end
post
end

View File

@@ -12,10 +12,10 @@ class Domain::Fa::Post < ReduxApplicationRecord
:removed, # post has been removed
:scan_error, # error scanning post page (see state_detail)
:file_error, # error downloading post file (see state_detail)
],
default: :ok
]
validates_inclusion_of(:state, in: self.states.keys)
validates_presence_of(:fa_id, :state)
after_initialize { self.state ||= :ok }
belongs_to :creator,
class_name: "::Domain::Fa::User",

View File

@@ -1,7 +1,6 @@
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);