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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d895db87072be887179ce6110bdc54801e0b56a23a4121c2b7c843ba4471c3c0
4
- data.tar.gz: 773bc76a3bf145241a0b1206841f292f8e9f9caee787c9e1a1085e40eff72bb3
3
+ metadata.gz: 80a97cd03f5103140f840a1d405c4e83ca40d3c7762f921c1b8d8c1b058a5565
4
+ data.tar.gz: e9a56af5e5ea6d54caf4c8695ab82c130a61667877122e1479c5f19f10a6e7a1
5
5
  SHA512:
6
- metadata.gz: '03097a86057f84f07750e15bb7a0efcca3b7bcfd95e6fe71ce78a79eefc6bdce00035210e685b0b61a0cfeb1f18ceae7676fb4d9f06e9734f8d658edb2a51c77'
7
- data.tar.gz: b6ba970874a73914255dc4d32bb96945b459fc5ba2ada0688bd908107043daf4f1febb885a2b151c44e6b0d1e35fdd2d96600c564bc4736b779c0db85f8b972e
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.1'
4
+ VERSION = '0.3.3'
5
5
  end
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
- response = {
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.1
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