async_block 0.3.0 → 0.3.2

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: d1af6c169b42d46213cdd17217c89caa2ff47fc006490fe8f4344762f3d8c8ff
4
- data.tar.gz: 66f8b318f6f4c7f346fd01a87e64ee28fdee2a2453b52bb597a892befccf55ce
3
+ metadata.gz: 649539d48c1563da8a4b0143cb24b75de2421bd58c212709e81adae060dc90bc
4
+ data.tar.gz: a6ad28a0638afb9fe4e70b61b3743bd4575dca868413a59c673aee00f554fe89
5
5
  SHA512:
6
- metadata.gz: 289add2b62acd3204dd2bbb4a24d91b56ce24f0418b5a93769b32fb6ed5a7cdcf80619d3a9a470a493c4f783440632878b801f23f199cf0e53d88cdac98da7d3
7
- data.tar.gz: d3f0ebe42ae78533aa48b0aa15fcdce44d2cb55a79b151c2be60c687600f63bb4869cb28b82de243c0a706347396bbbc580049fa7156c5a3970eea08d413c5a4
6
+ metadata.gz: 4ac6a453f468c8d02365547aa28817b6d1de1eb631419f046a94a94948e0daf6eb6b2c2775aab263d994e76a3086fc3199f8db17f790a50c888c52a96a84fd06
7
+ data.tar.gz: 274be67b6c81b6fc04f02f702c84ec3ea44d33fa03540355f378df2ea9a79a553a1c5833368cd46c8ab1e20594ae1f30bdf9a023b622e949b97b6bc195ba2a01
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AsyncBlock
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.2'
5
5
  end
data/lib/async_block.rb CHANGED
@@ -11,10 +11,12 @@ module AsyncBlock
11
11
  def self.run(queue: nil, delay: nil, &block)
12
12
  source = BlockToSource.new(block).convert
13
13
  queue ||= DEFAULT_QUEUE_NAME
14
- if delay.instance_of?(ActiveSupport::Duration)
15
- AsyncWrapperJob.set(wait: delay, queue: queue.to_sym).perform_later(source)
16
- else
17
- AsyncWrapperJob.set(queue: queue.to_sym).perform_later(source)
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
18
19
  end
20
+ response
19
21
  end
20
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async_block
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adittya Dey