async_block 0.2.8 → 0.3.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1af6c169b42d46213cdd17217c89caa2ff47fc006490fe8f4344762f3d8c8ff
|
4
|
+
data.tar.gz: 66f8b318f6f4c7f346fd01a87e64ee28fdee2a2453b52bb597a892befccf55ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289add2b62acd3204dd2bbb4a24d91b56ce24f0418b5a93769b32fb6ed5a7cdcf80619d3a9a470a493c4f783440632878b801f23f199cf0e53d88cdac98da7d3
|
7
|
+
data.tar.gz: d3f0ebe42ae78533aa48b0aa15fcdce44d2cb55a79b151c2be60c687600f63bb4869cb28b82de243c0a706347396bbbc580049fa7156c5a3970eea08d413c5a4
|
@@ -4,32 +4,39 @@ module AsyncBlock
|
|
4
4
|
# Custom active job inherited from ActiveJob to enable error logging and retries
|
5
5
|
class CustomActiveJob < ActiveJob::Base
|
6
6
|
before_perform do |job|
|
7
|
-
|
8
|
-
|
9
|
-
context = { arguments: job.arguments.to_json }
|
10
|
-
if Module.const_defined?(:Sentry)
|
11
|
-
Sentry.configure_scope do |scope|
|
12
|
-
scope.set_context('context', context)
|
13
|
-
end
|
7
|
+
if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.before_perform) == 'method'
|
8
|
+
AsyncWrapperService.before_perform(job)
|
14
9
|
end
|
15
|
-
Honeybadger.context(context) if Module.const_defined?(:Honeybadger)
|
16
10
|
end
|
17
11
|
|
18
|
-
|
12
|
+
after_enqueue do |job|
|
13
|
+
if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.after_enqueue) == 'method'
|
14
|
+
AsyncWrapperService.after_enqueue(job)
|
15
|
+
end
|
16
|
+
end
|
19
17
|
|
20
18
|
after_perform do |job|
|
21
|
-
|
22
|
-
|
19
|
+
if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.after_perform) == 'method'
|
20
|
+
AsyncWrapperService.after_perform(job)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
around_enqueue do |job|
|
25
|
+
if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.around_enqueue) == 'method'
|
26
|
+
AsyncWrapperService.around_enqueue(job)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
around_perform do |job|
|
31
|
+
if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.around_perform) == 'method'
|
32
|
+
AsyncWrapperService.around_perform(job)
|
33
|
+
end
|
23
34
|
end
|
24
35
|
|
25
36
|
retry_on StandardError, wait: :exponentially_longer, attempts: 3 do |job, error|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
This job was retried for #{job.executions} times.".squish
|
30
|
-
puts('retry_on', message)
|
31
|
-
Sentry.capture_message(message) if Module.const_defined?(:Sentry)
|
32
|
-
Honeybadger.notify(message) if Module.const_defined?(:Honeybadger)
|
37
|
+
if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.on_error) == 'method'
|
38
|
+
AsyncWrapperService.on_error(job, error)
|
39
|
+
end
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
data/lib/async_block/version.rb
CHANGED
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.
|
4
|
+
version: 0.3.0
|
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-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|