Skip to content

Commit

Permalink
Fix code style of regeneration-related code (mastodon#9843)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent 7fbbb1d commit 11db1af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ def prepare_returning_user!
end

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)
end

Expand Down
1 change: 1 addition & 0 deletions app/services/precompute_feed_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class PrecomputeFeedService < BaseService
def call(account)
FeedManager.instance.populate_feed(account)
ensure
Redis.current.del("account:#{account.id}:regeneration")
end
end

0 comments on commit 11db1af

Please sign in to comment.