Encapsulate redis key usage (#34840)
This commit is contained in:
parent
a73ade526a
commit
b195956ecb
6 changed files with 54 additions and 4 deletions
|
@ -531,7 +531,11 @@ class User < ApplicationRecord
|
|||
end
|
||||
|
||||
def regenerate_feed!
|
||||
RegenerationWorker.perform_async(account_id) if redis.set("account:#{account_id}:regeneration", true, nx: true, ex: 1.day.seconds)
|
||||
home_feed = HomeFeed.new(account)
|
||||
unless home_feed.regenerating?
|
||||
home_feed.regeneration_in_progress!
|
||||
RegenerationWorker.perform_async(account_id)
|
||||
end
|
||||
end
|
||||
|
||||
def needs_feed_update?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue