async_block 0.3.2 → 0.3.3

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: 649539d48c1563da8a4b0143cb24b75de2421bd58c212709e81adae060dc90bc
4
- data.tar.gz: a6ad28a0638afb9fe4e70b61b3743bd4575dca868413a59c673aee00f554fe89
3
+ metadata.gz: 80a97cd03f5103140f840a1d405c4e83ca40d3c7762f921c1b8d8c1b058a5565
4
+ data.tar.gz: e9a56af5e5ea6d54caf4c8695ab82c130a61667877122e1479c5f19f10a6e7a1
5
5
  SHA512:
6
- metadata.gz: 4ac6a453f468c8d02365547aa28817b6d1de1eb631419f046a94a94948e0daf6eb6b2c2775aab263d994e76a3086fc3199f8db17f790a50c888c52a96a84fd06
7
- data.tar.gz: 274be67b6c81b6fc04f02f702c84ec3ea44d33fa03540355f378df2ea9a79a553a1c5833368cd46c8ab1e20594ae1f30bdf9a023b622e949b97b6bc195ba2a01
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
- before_perform do |job|
7
- if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.before_perform) == 'method'
8
- AsyncWrapperService.before_perform(job)
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
- after_perform do |job|
19
- if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.after_perform) == 'method'
20
- AsyncWrapperService.after_perform(job)
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
- around_enqueue do |job|
25
- if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.around_enqueue) == 'method'
26
- AsyncWrapperService.around_enqueue(job)
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
- around_perform do |job|
31
- if Module.const_defined?(:AsyncWrapperService) && defined?(AsyncWrapperService.around_perform) == 'method'
32
- AsyncWrapperService.around_perform(job)
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?(:AsyncWrapperService) && defined?(AsyncWrapperService.on_error) == 'method'
38
- AsyncWrapperService.on_error(job, error)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AsyncBlock
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.3'
5
5
  end
data/lib/async_block.rb CHANGED
@@ -12,11 +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
- response = {}
16
- AsyncWrapperJob.set(wait: delay, queue: queue.to_sym).perform_later(source) do |job|
17
- response[:enqueued] = job.successfully_enqueued?
18
- response[:job] = job
19
- end
20
- response
15
+ AsyncWrapperJob.set(wait: delay, queue: queue.to_sym).perform_later(source)
21
16
  end
22
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.2
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-17 00:00:00.000000000 Z
11
+ date: 2023-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport