async-job 0.7.1 → 0.8.0

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: 5168ca3167c401c68ffca433ef65962420641cd4826e1d1fb9e4700bf5c9a5c8
4
- data.tar.gz: da6da3de6436cc9c1ade6523610033c683bafff75aa84640b12826b7d95cacfe
3
+ metadata.gz: 71fdcce6742cea5cfaeac68e800c56f1dbfa5ea6849503544c35912675874838
4
+ data.tar.gz: a607a76328c14cee24618479efd1d6924adc5634d7a89d21df0ccccbea78b1d8
5
5
  SHA512:
6
- metadata.gz: 3fb44c033b61704b4b5cb2d0b6ad2351d71c35d2f63c96efca439478c75e404e80e31caa91fe291d07e537bb3bd47d1114153071d49f78c7a33fc14e6ab6cab2
7
- data.tar.gz: 8371e91c27a9701cf34dacf575596c9af03dbbaa188837df5a6e90d9110f80d54056cd757b399a0e715f2a6268e128c7ee346dd2634fae40bd83f031f3bf7ad5
6
+ metadata.gz: 7bc8ac06036c862eb827af97ef43764dd44036dc14cdb5f988a294fc2dbbac5f441b32d71cd6551aa3000c190de82105fcce65771ced7b67d08a8f24e598c872
7
+ data.tar.gz: 145098c24c1a115d018a4ecc8a1796aa295c4cfb85b8099c30c2e82c9a89fd31780e525015e799a12be807e748c824f299ac88677afdf0764f7b1594094b758e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -75,8 +75,14 @@ module Async
75
75
  start! or @ready.signal
76
76
  end
77
77
 
78
+ def start
79
+ @delegate&.start
80
+ self.start!
81
+ end
82
+
78
83
  def stop
79
84
  @task&.stop
85
+ @delegate&.stop
80
86
  end
81
87
  end
82
88
  end
@@ -30,6 +30,14 @@ module Async
30
30
  Console.error(self, error)
31
31
  end
32
32
  end
33
+
34
+ def start
35
+ @delegate&.start
36
+ end
37
+
38
+ def stop
39
+ @delegate&.stop
40
+ end
33
41
  end
34
42
  end
35
43
  end
@@ -36,17 +36,37 @@ module Async
36
36
  @parent = parent || Async::Idler.new
37
37
  end
38
38
 
39
+ def start!
40
+ return false if @task
41
+
42
+ @task = true
43
+
44
+ @parent.async(transient: true, annotation: self.class.name) do |task|
45
+ @task = task
46
+
47
+ while true
48
+ self.dequeue(task)
49
+ end
50
+ ensure
51
+ @task = nil
52
+ end
53
+ end
54
+
39
55
  def start
40
- Console.info(self, "Starting server...")
56
+ @delegate&.start
57
+
41
58
  # Start the delayed queue, which will move jobs to the ready queue when they are ready:
42
59
  @delayed_queue.start(@ready_queue, resolution: @resolution)
43
60
 
44
61
  # Start the processing queue, which will move jobs to the ready queue when they are abandoned:
45
62
  @processing_queue.start
46
63
 
47
- while true
48
- self.dequeue(@parent)
49
- end
64
+ self.start!
65
+ end
66
+
67
+ def stop
68
+ @task&.stop
69
+ @delegate&.stop
50
70
  end
51
71
 
52
72
  def call(job)
@@ -27,6 +27,14 @@ module Async
27
27
  def pop
28
28
  @jobs.dequeue
29
29
  end
30
+
31
+ def start
32
+ @delegate&.start
33
+ end
34
+
35
+ def stop
36
+ @delegate&.stop
37
+ end
30
38
  end
31
39
  end
32
40
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Job
8
- VERSION = "0.7.1"
8
+ VERSION = "0.8.0"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
- rubygems_version: 3.5.13
119
+ rubygems_version: 3.5.11
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: A asynchronous job queue for Ruby.
metadata.gz.sig CHANGED
Binary file