async_block 0.2.8 → 0.2.9
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: 8c6e38b8eba31d3f7ad7da0e059939ca00e52a082179db6e5c15b266274cbe5d
|
4
|
+
data.tar.gz: 11141c0ffd733631143b4a1b042d6e022a1d54b1ec80eacb8b1ef525138215fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3efd5c6629a9c4946f5987928012f02d5de8a054b3f9ab88d31f1130f811d25040ee83931c499014e9448775e727d6b29614ffb5f9d9ef3636f4277e2608c70a
|
7
|
+
data.tar.gz: 87e838de89cf0511ee9178dfd4d5314b9fb88262c166bf5fa7e0f4f8e34f4224e1998c1c321637c76e3fc5810742bfdac33bda6e62a5fbb9dac13db23f96db51
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'sourcify'
|
4
|
-
require 'method_source'
|
3
|
+
# require 'sourcify'
|
4
|
+
# require 'method_source'
|
5
5
|
|
6
6
|
module AsyncBlock
|
7
7
|
# BlockToSource - converts code block to source string
|
@@ -22,7 +22,7 @@ module AsyncBlock
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def block_to_source
|
25
|
-
@block&.to_source(:
|
25
|
+
@block&.to_source(strip_enclosure: true)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -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.2.
|
4
|
+
version: 0.2.9
|
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
|