funktor 0.7.25 → 0.7.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4efb77bf5008c8b7045610883ea0f0229a8ebaa89d1b5f3dd4846c3e0bc7ddd4
4
- data.tar.gz: ad9b24108efdc8747d863bc9afbf0b47fe9508c6804f48ca80eba314e681a474
3
+ metadata.gz: fe7973cd6c5d59ac83b10c4726244665bd0584f7abad03ccb89a49f6e20daf3b
4
+ data.tar.gz: ea2f3d112ff0565b1d21a72fb8398f7f776eca2f28368d0c1d397cdd24a50090
5
5
  SHA512:
6
- metadata.gz: a1d9c1547d1195bab096469043bef6bd63d4183b005a1ee6e08d60ad5f894fe79d0bdeaa33a446966566904a99a088045c66348f0eb9ca5aca1543b75adf9595
7
- data.tar.gz: ead715f1b9673487067fea8206e0bb9a0fb74bcc2a79e43bf3e07703df9a5d3f0fc3361bcde55357ef223078ed7dc1e215d325354614f379138142cc33e07bc3
6
+ metadata.gz: 5daf5129ffd987d9370a31405655c5940ab4eb0a0d2eb3fdb5d53fdb7794c8b5723999d359b3bc5cf56738ea89c027f7fffb84f1d68f49d0c1383a9d47f0b217
7
+ data.tar.gz: 9151e301390aa929b0de57aa3c8c909c3d858315528f121077e8ff4e99427a6de7f4904be66ba777b5c16e032d496f6e42e19a3d711f8d2ea259c245872e4bd9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- funktor (0.7.25)
4
+ funktor (0.7.26)
5
5
  activesupport
6
6
  aws-sdk-dynamodb (~> 1.62)
7
7
  aws-sdk-sqs (~> 1.37)
data/lib/funktor/job.rb CHANGED
@@ -114,8 +114,16 @@ module Funktor
114
114
  self.delay = seconds_to_delay(retries)
115
115
  end
116
116
 
117
- # delayed_job and sidekiq use the same basic formula
118
117
  def seconds_to_delay(count)
118
+ if worker_class&.funktor_retry_in_block
119
+ worker_class.funktor_retry_in_block.call(count)
120
+ else
121
+ default_seconds_to_delay(count)
122
+ end
123
+ end
124
+
125
+ # delayed_job and sidekiq use the same basic formula
126
+ def default_seconds_to_delay(count)
119
127
  (count**4) + 15 + (rand(30) * (count + 1))
120
128
  end
121
129
 
@@ -124,7 +132,7 @@ module Funktor
124
132
  end
125
133
 
126
134
  def retry_limit
127
- 25
135
+ worker_class&.custom_retry_limit || 25
128
136
  end
129
137
 
130
138
  def can_retry
@@ -1,3 +1,3 @@
1
1
  module Funktor
2
- VERSION = "0.7.25"
2
+ VERSION = "0.7.26"
3
3
  end
@@ -7,6 +7,7 @@ module Funktor
7
7
  base.extend ClassMethods
8
8
  base.class_eval do
9
9
  class_attribute :funktor_options_hash
10
+ class_attribute :funktor_retry_in_block
10
11
  end
11
12
  end
12
13
  module ClassMethods
@@ -18,6 +19,10 @@ module Funktor
18
19
  self.funktor_options_hash || {}
19
20
  end
20
21
 
22
+ def funktor_retry_in(&block)
23
+ self.funktor_retry_in_block = block
24
+ end
25
+
21
26
  def custom_queue_url
22
27
  get_funktor_options[:queue_url]
23
28
  end
@@ -26,6 +31,16 @@ module Funktor
26
31
  get_funktor_options[:queue]
27
32
  end
28
33
 
34
+ def custom_retry_limit
35
+ retry_limit = get_funktor_options[:retry]
36
+ if retry_limit.nil?
37
+ retry_limit = 25
38
+ elsif !retry_limit # if someone did "retry: false"
39
+ retry_limit = 0
40
+ end
41
+ return retry_limit
42
+ end
43
+
29
44
  def queue_url
30
45
  custom_queue_url
31
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: funktor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.25
4
+ version: 0.7.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Green
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2022-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sqs