]> cat aescling's git repositories - mastodon.git/commitdiff
Fix code style of regeneration-related code (#9843)
authorEugen Rochko <eugen@zeonfederated.com>
Fri, 18 Jan 2019 00:02:51 +0000 (01:02 +0100)
committerGitHub <noreply@github.com>
Fri, 18 Jan 2019 00:02:51 +0000 (01:02 +0100)
app/models/user.rb
app/services/precompute_feed_service.rb

index 8b374c1825b71fff81e7fccdc2319e521c5ed3ef..5aa5c2b15c4a6be9b64fc822092785dc6a9811cc 100644 (file)
@@ -362,7 +362,8 @@ class User < ApplicationRecord
   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
 
index 4f771ff7233966eb307267e805b199eca6cd1576..076dedacab97dfed799c5c417b4ada969e0555e4 100644 (file)
@@ -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