async_block 0.2.3 → 0.2.4
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/lib/async_block/async_wrapper_job.rb +18 -9
- data/lib/async_block/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecd9d7e535b3cc5a1c3202a298246dd4d3ac610cd5fde6af8123590608f92692
|
4
|
+
data.tar.gz: cdb1f518b1c333d5b93cdca58e83c46efcb709a3d59b4d0b04899460deee1123
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511fa72a1d25adefa23f78ea983a98610715ec72e2ad22af09248a122fbd85244ad1e51dea1fa83d943626ff5c929a4cb8ecb1e39374d1d094025e864d0a9274
|
7
|
+
data.tar.gz: c21922bbab72a2ad274f846b703e17834a52d95438e858abcfa685b03b3f281a5f4a7f1b4b7ee61cc89a590df34324d742e21f6d4ce7b93a34b4e86e70c370ca
|
@@ -9,14 +9,18 @@ module AsyncBlock
|
|
9
9
|
queue_as :async_wrapper_job
|
10
10
|
|
11
11
|
retry_on StandardError, wait: :exponentially_longer, attempts: 3 do |job, error|
|
12
|
-
send_error_message(job, error)
|
12
|
+
# send_error_message(job, error)
|
13
|
+
error_message = "Stopped retrying #{job.class} (JID #{job.job_id})
|
14
|
+
with #{job.arguments.join(', ')} due to
|
15
|
+
'#{error.class} - #{error.message}'.
|
16
|
+
This job was retried for #{job.executions} times.".squish
|
17
|
+
on_error(error_message)
|
13
18
|
end
|
14
19
|
|
15
20
|
def perform(source, on_error_source)
|
21
|
+
initialize_on_error(on_error_source)
|
16
22
|
# Converts source code to callable block
|
17
23
|
block = source_to_block(source)
|
18
|
-
# Puts :on_error method in instance
|
19
|
-
source_to_block(on_error_source).call
|
20
24
|
execute_block!(block)
|
21
25
|
end
|
22
26
|
|
@@ -30,12 +34,17 @@ module AsyncBlock
|
|
30
34
|
block.call
|
31
35
|
end
|
32
36
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
36
|
-
'#{error.class} - #{error.message}'.
|
37
|
-
This job was retried for #{job.executions} times.".squish
|
38
|
-
on_error(error_message)
|
37
|
+
def initialize_on_error(on_error_source)
|
38
|
+
# Puts :on_error method in instance
|
39
|
+
source_to_block(on_error_source).call
|
39
40
|
end
|
41
|
+
|
42
|
+
# def send_error_message(job, error)
|
43
|
+
# error_message = "Stopped retrying #{job.class} (JID #{job.job_id})
|
44
|
+
# with #{job.arguments.join(', ')} due to
|
45
|
+
# '#{error.class} - #{error.message}'.
|
46
|
+
# This job was retried for #{job.executions} times.".squish
|
47
|
+
# on_error(error_message)
|
48
|
+
# end
|
40
49
|
end
|
41
50
|
end
|
data/lib/async_block/version.rb
CHANGED