0
0
Fork 0

Improve feed regeneration

This commit is contained in:
Eugen Rochko 2016-11-08 02:08:32 +01:00
parent 096bfbad96
commit bb4d1eb2e8
5 changed files with 15 additions and 11 deletions

View file

@ -11,7 +11,8 @@ class Feed
# If we're after most recent items and none are there, we need to precompute the feed
if unhydrated.empty? && max_id == '+inf' && since_id == '-inf'
PrecomputeFeedService.new.call(@type, @account, limit)
RegenerationWorker.perform_async(@account.id, @type)
Status.send("as_#{@type}_timeline", @account).paginate_by_max_id(limit, nil, nil)
else
status_map = Status.where(id: unhydrated).with_includes.with_counters.map { |status| [status.id, status] }.to_h
unhydrated.map { |id| status_map[id] }.compact