Fix code style of regeneration-related code (#9843)
This commit is contained in:
parent
4abfcbd614
commit
9a98e3fe76
2 changed files with 3 additions and 1 deletions
|
@ -362,7 +362,8 @@ class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def regenerate_feed!
|
def regenerate_feed!
|
||||||
Redis.current.setnx("account:#{account_id}:regeneration", true) && Redis.current.expire("account:#{account_id}:regeneration", 1.day.seconds)
|
return unless Redis.current.setnx("account:#{account_id}:regeneration", true)
|
||||||
|
Redis.current.expire("account:#{account_id}:regeneration", 1.day.seconds)
|
||||||
RegenerationWorker.perform_async(account_id)
|
RegenerationWorker.perform_async(account_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
class PrecomputeFeedService < BaseService
|
class PrecomputeFeedService < BaseService
|
||||||
def call(account)
|
def call(account)
|
||||||
FeedManager.instance.populate_feed(account)
|
FeedManager.instance.populate_feed(account)
|
||||||
|
ensure
|
||||||
Redis.current.del("account:#{account.id}:regeneration")
|
Redis.current.del("account:#{account.id}:regeneration")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue