about summary refs log tree commit diff
path: root/app/workers/concerns/exponential_backoff.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-02-28 22:02:36 +0100
committerGitHub <noreply@github.com>2019-02-28 22:02:36 +0100
commitb969b150e8f095dc91c19c7381923c2c19edb968 (patch)
tree015d70b4b633fadf70cab9d0a0b0fbd55e6456ae /app/workers/concerns/exponential_backoff.rb
parent76ed481aa7b67d624675cdaa85bac583853fd24d (diff)
parent2267eee356a3d2b8ebb20892c5182b6f8169403e (diff)
Merge pull request #932 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
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