Some checks are pending
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Check formatting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / Libvips tests (push) Blocked by required conditions
Ruby Testing / End to End testing (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (push) Blocked by required conditions
Ruby Testing / Back to original and return test (push) Blocked by required conditions
revert Top posts test
23 lines
642 B
Ruby
23 lines
642 B
Ruby
# frozen_string_literal: true
|
|
|
|
class PrecomputeFeedService < BaseService
|
|
include Redisable
|
|
|
|
def call(account, skip_filled_timelines: false)
|
|
@skip_filled_timelines = skip_filled_timelines
|
|
|
|
FeedManager.instance.populate_home(account) unless skip_timeline?(:home, account.id)
|
|
|
|
account.owned_lists.each do |list|
|
|
FeedManager.instance.populate_list(list) unless skip_timeline?(:list, list.id)
|
|
end
|
|
ensure
|
|
redis.del("account:#{account.id}:regeneration")
|
|
end
|
|
|
|
private
|
|
|
|
def skip_timeline?(type, id)
|
|
@skip_filled_timelines && FeedManager.instance.timeline_size(type, id) * 2 > FeedManager::MAX_ITEMS
|
|
end
|
|
end
|