Browse Source

Do not raise an error if PrecomputeFeed could not find any status (#4015)

closed-social-v3
Akihiko Odaki (@fn_aki@pawoo.net) 7 years ago
committed by Eugen Rochko
parent
commit
7362469d89
2 changed files with 6 additions and 1 deletions
  1. +1
    -1
      app/services/precompute_feed_service.rb
  2. +5
    -0
      spec/services/precompute_feed_service_spec.rb

+ 1
- 1
app/services/precompute_feed_service.rb View File

@ -16,7 +16,7 @@ class PrecomputeFeedService < BaseService
pairs = statuses.reverse_each.map(&method(:process_status))
redis.pipelined do
redis.zadd(account_home_key, pairs)
redis.zadd(account_home_key, pairs) if pairs.any?
redis.del("account:#{@account.id}:regeneration")
end
end

+ 5
- 0
spec/services/precompute_feed_service_spec.rb View File

@ -18,5 +18,10 @@ RSpec.describe PrecomputeFeedService do
expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to eq status.id
end
it 'does not raise an error even if it could not find any status' do
account = Fabricate(:account)
subject.call(account)
end
end
end

Loading…
Cancel
Save