Skip to content

A platform for community discussion. Free, open, simple.

minor cleanup to previous commit from code review

Same0e6dae6a7e4
diff --git a/app/models/optimized_image.rb b/app/models/optimized_image.rb
index 5919ccf13ee..762faafea44 100644
--- a/app/models/optimized_image.rb
+++ b/app/models/optimized_image.rb
@@ -43,7 +43,7 @@ class OptimizedImage < ActiveRecord::Base
# correct bad thumbnail if needed
if thumbnail && thumbnail.url.blank?
- thumbnail.destroy
+ thumbnail.destroy!
thumbnail = nil
end
diff --git a/lib/distributed_mutex.rb b/lib/distributed_mutex.rb
index 76def3e7859..aac583e3a7e 100644
--- a/lib/distributed_mutex.rb
+++ b/lib/distributed_mutex.rb
@@ -22,10 +22,12 @@ class DistributedMutex
while !try_to_get_lock
sleep 0.001
- attempts += 1
# in readonly we will never be able to get a lock
- if @using_global_redis && attempts > CHECK_READONLY_ATTEMPT
- raise Discourse::ReadOnly
+ if @using_global_redis
+ attempts += 1
+ if attempts > CHECK_READONLY_ATTEMPT
+ raise Discourse::ReadOnly
+ end
end
end