funktor 0.7.25 → 0.7.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/funktor/job.rb +10 -2
- data/lib/funktor/version.rb +1 -1
- data/lib/funktor/worker/funktor_options.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe7973cd6c5d59ac83b10c4726244665bd0584f7abad03ccb89a49f6e20daf3b
|
4
|
+
data.tar.gz: ea2f3d112ff0565b1d21a72fb8398f7f776eca2f28368d0c1d397cdd24a50090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5daf5129ffd987d9370a31405655c5940ab4eb0a0d2eb3fdb5d53fdb7794c8b5723999d359b3bc5cf56738ea89c027f7fffb84f1d68f49d0c1383a9d47f0b217
|
7
|
+
data.tar.gz: 9151e301390aa929b0de57aa3c8c909c3d858315528f121077e8ff4e99427a6de7f4904be66ba777b5c16e032d496f6e42e19a3d711f8d2ea259c245872e4bd9
|
data/Gemfile.lock
CHANGED
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
|
data/lib/funktor/version.rb
CHANGED
@@ -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.
|
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-
|
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
|