0
0
Fork 0

Refactor reply-fetching code and disable it by default (#34147)

This commit is contained in:
Claire 2025-03-12 11:28:06 +01:00 committed by GitHub
parent 46e13dd81c
commit 9db26db495
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 15 additions and 35 deletions

View file

@ -4,7 +4,7 @@ module Status::FetchRepliesConcern
extend ActiveSupport::Concern
# enable/disable fetching all replies
FETCH_REPLIES_ENABLED = ENV.key?('FETCH_REPLIES_ENABLED') ? ENV['FETCH_REPLIES_ENABLED'] == 'true' : true
FETCH_REPLIES_ENABLED = ENV['FETCH_REPLIES_ENABLED'] == 'true'
# debounce fetching all replies to minimize DoS
FETCH_REPLIES_COOLDOWN_MINUTES = (ENV['FETCH_REPLIES_COOLDOWN_MINUTES'] || 15).to_i.minutes
@ -40,14 +40,4 @@ module Status::FetchRepliesConcern
fetched_replies_at.nil? || fetched_replies_at <= FETCH_REPLIES_COOLDOWN_MINUTES.ago
)
end
def unsubscribed?
return false if local?
!Follow.joins(:account).exists?(
target_account: account.id,
account: { domain: nil },
created_at: ..updated_at
)
end
end