quick hack to optimize finding max valid fa_id
This commit is contained in:
@@ -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
9
sorbet/rbi/shims/aux.rbi
Normal file
@@ -0,0 +1,9 @@
|
||||
# typed: strict
|
||||
|
||||
class DomainPostsFaAux < ActiveRecord::Base
|
||||
extend T::Sig
|
||||
|
||||
sig { returns(T.nilable(Integer)) }
|
||||
def fa_id
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user