async_block 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/async_block/async_wrapper_job.rb +1 -1
- data/lib/async_block/version.rb +1 -1
- data/lib/async_block.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2130f23729cead7cdd271b467edc3f5ab940cb2dd121e7b0bdeb6e4b37fa1eb1
|
4
|
+
data.tar.gz: 8e7d3d8321f8575d64781aa1b61518d7ffbfe4fd9cbd8a63f45a4317fe8c606a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2034c98fa200ee440f9cec18cf4b78892798048739af52dcede0b01c6fbe7282bec4e9b346843f6f13d3661a9d012773ac722af2e28d3e95020c27e8644088de
|
7
|
+
data.tar.gz: d93484c7759261ae68290bc7bbdf6c6a6961ee6dc857b8d42b981fe7fe3399fb9a4d4a98352bec3efa32ccfc741f44521f03467c2aa1b0b11e45f7faeadc4b0e
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Add your code in wrapped inside AsyncBlock as described below.
|
|
18
18
|
\*\* NOTE - AsyncBlock cannot be executed from irb/console
|
19
19
|
|
20
20
|
```
|
21
|
-
AsyncBlock.
|
21
|
+
AsyncBlock.run do
|
22
22
|
puts('This is running in a temporary job')
|
23
23
|
puts('Put your code below')
|
24
24
|
end
|
@@ -27,7 +27,7 @@ end
|
|
27
27
|
To put some delay on the async execution (say 5 minutes):
|
28
28
|
|
29
29
|
```
|
30
|
-
AsyncBlock.
|
30
|
+
AsyncBlock.run(delay: 5.minutes) do
|
31
31
|
puts('This is running in a temporary job')
|
32
32
|
puts('Put your code below')
|
33
33
|
end
|
@@ -36,7 +36,7 @@ end
|
|
36
36
|
To explicitly mention a queue for the async execution:
|
37
37
|
|
38
38
|
```
|
39
|
-
AsyncBlock.
|
39
|
+
AsyncBlock.run(delay: 1.minute, queue: 'p3') do
|
40
40
|
puts('This is running in a temporary job')
|
41
41
|
puts('Put your code below')
|
42
42
|
end
|
data/lib/async_block/version.rb
CHANGED
data/lib/async_block.rb
CHANGED
@@ -10,7 +10,7 @@ require_relative 'async_block/async_wrapper_job'
|
|
10
10
|
module AsyncBlock
|
11
11
|
class Error < StandardError; end
|
12
12
|
|
13
|
-
def self.
|
13
|
+
def self.run(queue: nil, delay: nil, &block)
|
14
14
|
source = BlockToSource.new(block).convert
|
15
15
|
queue ||= DEFAULT_QUEUE_NAME
|
16
16
|
if delay.instance_of?(ActiveSupport::Duration)
|