async_block 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async_block/custom_active_job.rb +14 -20
- data/lib/async_block/version.rb +1 -1
- data/lib/async_block.rb +1 -8
- 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: 80a97cd03f5103140f840a1d405c4e83ca40d3c7762f921c1b8d8c1b058a5565
|
4
|
+
data.tar.gz: e9a56af5e5ea6d54caf4c8695ab82c130a61667877122e1479c5f19f10a6e7a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d64acd35dad1da0b08cdf62e2f44c585aa2f1f887d47750f631594e7a429915bb45c8a81011aab94595ea226e44fec3f563533fa8b22509e409985cf0e851df
|
7
|
+
data.tar.gz: c12cc9a366b67729b38a1a75a91de909e4fe1651b6c331de551a7f09b5fe53a0a382d2727c52e225e595b76437a508e8983e64cf50c002bc95fe62efa5513eac
|
@@ -3,39 +3,33 @@
|
|
3
3
|
module AsyncBlock
|
4
4
|
# Custom active job inherited from ActiveJob to enable error logging and retries
|
5
5
|
class CustomActiveJob < ActiveJob::Base
|
6
|
-
|
7
|
-
if Module.const_defined?(:
|
8
|
-
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
after_enqueue do |job|
|
13
|
-
if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.after_enqueue) == 'method'
|
14
|
-
AsyncWrapperService.after_enqueue(job)
|
6
|
+
before_enqueue do |job|
|
7
|
+
if Module.const_defined?(:AsyncBlockService) && defined?(AsyncBlockService.before_enqueue) == 'method'
|
8
|
+
AsyncBlockService.before_enqueue(job)
|
15
9
|
end
|
16
10
|
end
|
17
11
|
|
18
|
-
|
19
|
-
if Module.const_defined?(:
|
20
|
-
|
12
|
+
before_perform do |job|
|
13
|
+
if Module.const_defined?(:AsyncBlockService) && defined?(AsyncBlockService.before_perform) == 'method'
|
14
|
+
AsyncBlockService.before_perform(job)
|
21
15
|
end
|
22
16
|
end
|
23
17
|
|
24
|
-
|
25
|
-
if Module.const_defined?(:
|
26
|
-
|
18
|
+
after_enqueue do |job|
|
19
|
+
if Module.const_defined?(:AsyncBlockService) && defined?(AsyncBlockService.after_enqueue) == 'method'
|
20
|
+
AsyncBlockService.after_enqueue(job)
|
27
21
|
end
|
28
22
|
end
|
29
23
|
|
30
|
-
|
31
|
-
if Module.const_defined?(:
|
32
|
-
|
24
|
+
after_perform do |job|
|
25
|
+
if Module.const_defined?(:AsyncBlockService) && defined?(AsyncBlockService.after_perform) == 'method'
|
26
|
+
AsyncBlockService.after_perform(job)
|
33
27
|
end
|
34
28
|
end
|
35
29
|
|
36
30
|
retry_on StandardError, wait: :exponentially_longer, attempts: 3 do |job, error|
|
37
|
-
if Module.const_defined?(:
|
38
|
-
|
31
|
+
if Module.const_defined?(:AsyncBlockService) && defined?(AsyncBlockService.on_error) == 'method'
|
32
|
+
AsyncBlockService.on_error(job, error)
|
39
33
|
end
|
40
34
|
end
|
41
35
|
end
|
data/lib/async_block/version.rb
CHANGED
data/lib/async_block.rb
CHANGED
@@ -12,13 +12,6 @@ module AsyncBlock
|
|
12
12
|
source = BlockToSource.new(block).convert
|
13
13
|
queue ||= DEFAULT_QUEUE_NAME
|
14
14
|
delay = nil if delay.present? && !delay.instance_of?(ActiveSupport::Duration)
|
15
|
-
|
16
|
-
enqueued: false,
|
17
|
-
job: nil
|
18
|
-
}
|
19
|
-
AsyncWrapperJob.set(wait: delay, queue: queue.to_sym).perform_later(source) do |job|
|
20
|
-
response[:enqueued] = job.successfully_enqueued?
|
21
|
-
response[:job] = job
|
22
|
-
end
|
15
|
+
AsyncWrapperJob.set(wait: delay, queue: queue.to_sym).perform_later(source)
|
23
16
|
end
|
24
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async_block
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adittya Dey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|