quick hack to optimize finding max valid fa_id

This commit is contained in:
Dylan Knutson
2025-07-27 20:24:06 +00:00
parent c43d1ca197
commit 4ed1c558b9
2 changed files with 11 additions and 1 deletions

View File

@@ -27,7 +27,8 @@ namespace :fa do
start_at = ENV["start_at"]
if start_at.is_a?(String) && start_at == "last"
start_at = Domain::Post::FaPost.where(state: :ok).maximum(:fa_id) - 1000
Domain::Post::FaPost.last
start_at = DomainPostsFaAux.where(state: :ok).maximum(:fa_id) - 1000
start_at = 0 if start_at < 0
stop_at =
ENV["stop_at"]&.to_i || GlobalState.get(global_state_key)&.to_i ||

9
sorbet/rbi/shims/aux.rbi Normal file
View File

@@ -0,0 +1,9 @@
# typed: strict
class DomainPostsFaAux < ActiveRecord::Base
extend T::Sig
sig { returns(T.nilable(Integer)) }
def fa_id
end
end