toiler 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/toiler/actor/supervisor.rb +17 -7
- data/lib/toiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5094f14a48bb93a3fc011131d90b99d1efbc65b
|
4
|
+
data.tar.gz: b8a2aad41830c1386e7e80f88bb23bc93ae8090e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0abd85e8597d0777923e5c918579aee7225fdfe806ac549d01d8a662969d001855a1dd65ce5bdc65fb255dbf6651bede1766dfb3f5493a10a9d5f16f7476e6e7
|
7
|
+
data.tar.gz: 09347dbc2a2946db435387221163bf8bf03e92604ddd5e6fb7cdcee39a63ec089af5befb8dda6ee5e96825301b74b90bac10b64268235344ca61712e25e8fdbc
|
@@ -5,6 +5,8 @@ module Toiler
|
|
5
5
|
module Actor
|
6
6
|
# Actor that starts and supervises Toiler's actors
|
7
7
|
class Supervisor < Concurrent::Actor::RestartingContext
|
8
|
+
include Utils::ActorLogging
|
9
|
+
|
8
10
|
attr_accessor :client
|
9
11
|
|
10
12
|
def initialize
|
@@ -23,9 +25,13 @@ module Toiler
|
|
23
25
|
|
24
26
|
def spawn_fetchers
|
25
27
|
queues.each do |queue, _klass|
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
begin
|
29
|
+
fetcher = Actor::Fetcher.spawn! name: "fetcher_#{queue}".to_sym,
|
30
|
+
supervise: true, args: [queue, client]
|
31
|
+
Toiler.set_fetcher queue, fetcher
|
32
|
+
rescue StandardError => e
|
33
|
+
error "Failed to start Fetcher for queue #{queue}: #{e.message}\n#{e.backtrace.join("\n")}"
|
34
|
+
end
|
29
35
|
end
|
30
36
|
end
|
31
37
|
|
@@ -33,11 +39,15 @@ module Toiler
|
|
33
39
|
queues.each do |queue, klass|
|
34
40
|
name = "processor_pool_#{queue}".to_sym
|
35
41
|
count = klass.concurrency
|
36
|
-
|
37
|
-
Actor::
|
38
|
-
|
42
|
+
begin
|
43
|
+
pool = Concurrent::Actor::Utils::Pool.spawn! name, count do |index|
|
44
|
+
Actor::Processor.spawn name: "processor_#{queue}_#{index}".to_sym,
|
45
|
+
supervise: true, args: [queue]
|
46
|
+
end
|
47
|
+
Toiler.set_processor_pool queue, pool
|
48
|
+
rescue StandardError => e
|
49
|
+
error "Failed to spawn Processor Pool for queue #{queue}: #{e.message}\n#{e.backtrace.join("\n")}"
|
39
50
|
end
|
40
|
-
Toiler.set_processor_pool queue, pool
|
41
51
|
end
|
42
52
|
end
|
43
53
|
end
|
data/lib/toiler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Schepens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|