about summary refs log tree commit diff
path: root/app/workers/concerns/exponential_backoff.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-02-28 21:35:53 +0100
committerThibaut Girka <thib@sitedethib.com>2019-02-28 21:35:53 +0100
commit2267eee356a3d2b8ebb20892c5182b6f8169403e (patch)
tree015d70b4b633fadf70cab9d0a0b0fbd55e6456ae /app/workers/concerns/exponential_backoff.rb
parent76ed481aa7b67d624675cdaa85bac583853fd24d (diff)
parentee7d79c0ce411ff7754e3ac31dbf27cb9e298f73 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/workers/concerns/exponential_backoff.rb')
-rw-r--r--app/workers/concerns/exponential_backoff.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/workers/concerns/exponential_backoff.rb b/app/workers/concerns/exponential_backoff.rb
new file mode 100644
index 000000000..f2b931e33
--- /dev/null
+++ b/app/workers/concerns/exponential_backoff.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module ExponentialBackoff
+  extend ActiveSupport::Concern
+
+  included do
+    sidekiq_retry_in do |count|
+      15 + 10 * (count**4) + rand(10 * (count**4))
+    end
+  end
+end