about summary refs log tree commit diff
path: root/lib/paperclip
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-06-01 19:23:31 +0200
committerGitHub <noreply@github.com>2022-06-01 19:23:31 +0200
commit9d4861b4988e07636aa9c02f0732e8228791e9df (patch)
tree3151cad0cb134ec63d1d2ba33d6a32aedee1ca93 /lib/paperclip
parentae4f068a845d710c2e60ecf8b49144892505e773 (diff)
Remove dependency on running Redis server for db:setup (#18560)
Diffstat (limited to 'lib/paperclip')
-rw-r--r--lib/paperclip/attachment_extensions.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/paperclip/attachment_extensions.rb b/lib/paperclip/attachment_extensions.rb
index 786f558e9..d66a17623 100644
--- a/lib/paperclip/attachment_extensions.rb
+++ b/lib/paperclip/attachment_extensions.rb
@@ -81,6 +81,9 @@ module Paperclip
     # to respond or don't respond at all and as such minimize the
     # impact of object storage outages on application throughput
     def save
+      # Don't go through Stoplight if we don't have anything object-storage-oriented to do
+      return super if @queued_for_delete.empty? && @queued_for_write.empty? && !dirty?
+
       Stoplight('object-storage') { super }.with_threshold(STOPLIGHT_THRESHOLD).with_cool_off_time(STOPLIGHT_COOLDOWN).with_error_handler do |error, handle|
         if error.is_a?(Seahorse::Client::NetworkingError)
           handle.call(error)