run_rabbit_run 0.0.3 → 0.0.4
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.
- data/lib/run_rabbit_run/config/worker.rb +2 -2
- data/lib/run_rabbit_run/processes/worker.rb +3 -1
- data/lib/run_rabbit_run/version.rb +1 -1
- data/lib/run_rabbit_run/workers.rb +19 -3
- data/run_rabbit_run.gemspec +0 -1
- data/spec/dummy/config/rrr.rb +2 -0
- data/spec/dummy/config/rrr/development.rb +1 -1
- data/spec/dummy/workers/worker_name_3.rb +5 -0
- metadata +3 -17
@@ -10,7 +10,7 @@ module RunRabbitRun
|
|
10
10
|
processes: 1,
|
11
11
|
}.merge(options)
|
12
12
|
|
13
|
-
@options[:processes] = 1 unless @options[:processes].to_i
|
13
|
+
@options[:processes] = 1 unless @options[:processes].to_i >= 0
|
14
14
|
|
15
15
|
raise "File not exists: #{@options[:path]}" unless File.exists?(@options[:path])
|
16
16
|
end
|
@@ -24,7 +24,7 @@ module RunRabbitRun
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def processes value
|
27
|
-
options[:processes] = value
|
27
|
+
options[:processes] = value >= 0 ? value : 1
|
28
28
|
end
|
29
29
|
|
30
30
|
def log_to_master value
|
@@ -26,7 +26,9 @@ module RunRabbitRun
|
|
26
26
|
system_messages.publish(@name, :master, :message_processed, { queue: queue.name } ) if @options[:log_to_master]
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
add_timer 1 do
|
30
|
+
rabbitmq.instance_eval File.read(@options[:path]), @options[:path]
|
31
|
+
end
|
30
32
|
|
31
33
|
before_exit do
|
32
34
|
system_messages.publish(@name, :master, :process_quit)
|
@@ -18,16 +18,32 @@ module RunRabbitRun
|
|
18
18
|
|
19
19
|
def check
|
20
20
|
@workers.each do | name, workers |
|
21
|
+
processes = RunRabbitRun.config[:workers][name][:processes]
|
22
|
+
|
21
23
|
workers.each do | guid, worker |
|
22
|
-
|
24
|
+
unless worker.running?
|
25
|
+
if processes == 0
|
26
|
+
@workers[name].delete(guid)
|
27
|
+
else
|
28
|
+
worker.run
|
29
|
+
end
|
30
|
+
end
|
23
31
|
end
|
24
|
-
diff =
|
32
|
+
diff = processes - workers.size
|
25
33
|
diff.times{ run_new_worker name } if diff > 0
|
26
34
|
end
|
27
35
|
end
|
28
36
|
|
29
37
|
def add name
|
30
|
-
|
38
|
+
if RunRabbitRun.config[:run].include? name.to_sym
|
39
|
+
run_new_worker name
|
40
|
+
else
|
41
|
+
if RunRabbitRun.config[:workers].keys.include? name.to_sym
|
42
|
+
RunRabbitRun.logger.error "[#{name}] worker is not included into [#{RunRabbitRun.config[:environment]}] profile"
|
43
|
+
else
|
44
|
+
RunRabbitRun.logger.error "No configuration found for [#{name}] worker"
|
45
|
+
end
|
46
|
+
end
|
31
47
|
end
|
32
48
|
|
33
49
|
def remove name
|
data/run_rabbit_run.gemspec
CHANGED
data/spec/dummy/config/rrr.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
run :worker1, :worker2
|
1
|
+
run :worker1, :worker2, :worker3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: run_rabbit_run
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -75,22 +75,6 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: pry-remote
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
78
|
description: RunRabbitRun gem lets to run and manage multiple ruby processes for RabbitMQ
|
95
79
|
email:
|
96
80
|
- arturs.kreipans@gmail.com
|
@@ -126,6 +110,7 @@ files:
|
|
126
110
|
- spec/dummy/config/rrr/development.rb
|
127
111
|
- spec/dummy/workers/worker_name_1.rb
|
128
112
|
- spec/dummy/workers/worker_name_2.rb
|
113
|
+
- spec/dummy/workers/worker_name_3.rb
|
129
114
|
homepage: ''
|
130
115
|
licenses: []
|
131
116
|
post_install_message:
|
@@ -157,3 +142,4 @@ test_files:
|
|
157
142
|
- spec/dummy/config/rrr/development.rb
|
158
143
|
- spec/dummy/workers/worker_name_1.rb
|
159
144
|
- spec/dummy/workers/worker_name_2.rb
|
145
|
+
- spec/dummy/workers/worker_name_3.rb
|