serverengine 2.0.0pre2 → 2.0.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
  SHA1:
3
- metadata.gz: 0624473f82b51ace3b39db1d685218fc18a453d7
4
- data.tar.gz: a416727fa4596bc181953c34d0e65cc15b1442f4
3
+ metadata.gz: 4f113bd0243d7ab01e1ee3256f159ca24e3fcaaf
4
+ data.tar.gz: 98700347259e4cdd7884fd86b4875944ad6f922d
5
5
  SHA512:
6
- metadata.gz: 72971d1ba56510aa6df7a65ab4c4fa0e7ba010a3549e4fe26d2c049d07b88c8bb41aa167ee3b82a6f7f49e870346967efe3134c821be71d824296d25c271a9de
7
- data.tar.gz: 3eac8fe2391574de2b97a904c64f772d63292b17f95838afe184f5cd763141e8141ff548e21de8ad1fac0112a6e55dd979109572189d9017ddc043357e9bdae3
6
+ metadata.gz: 602df54ace3a99dff2557c4bf450cf57528dc8f080c0b1674c77978074620320ca8dec4a1f0c351c09e9731cf8fbf8dc7a2152736d4e90169e00141eb805dee6
7
+ data.tar.gz: bac416916a5270e51bf4cc39cc34c697e86d33821597b93d832d865ad2edcddc39a827ed9659ad14b02ac0c5af7870c2972d00e887adc511e6625333d9e9dd2f
@@ -52,7 +52,6 @@ module ServerEngine
52
52
  @chumask = @config[:chumask]
53
53
 
54
54
  @pid = nil
55
- @command_pipe = @config.fetch(:command_pipe, nil)
56
55
  @command_sender = @config.fetch(:command_sender, ServerEngine.windows? ? "pipe" : "signal")
57
56
  if @command_sender == "pipe"
58
57
  extend ServerEngine::CommandSender::Pipe
@@ -1,3 +1,3 @@
1
1
  module ServerEngine
2
- VERSION = "2.0.0pre2"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -0,0 +1,26 @@
1
+ require 'timeout'
2
+
3
+ describe ServerEngine::MultiSpawnServer do
4
+ include_context 'test server and worker'
5
+
6
+ context 'with command_sender=pipe' do
7
+ it 'starts worker processes' do
8
+ config = {workers: 2, command_sender: 'pipe', log_stdout: false, log_stderr: false}
9
+
10
+ s = ServerEngine::MultiSpawnServer.new(TestWorker) { config.dup }
11
+ t = Thread.new { s.main }
12
+
13
+ begin
14
+ wait_for_fork
15
+
16
+ Timeout.timeout(5) do
17
+ sleep(0.5) until test_state(:worker_run) == 2
18
+ end
19
+ test_state(:worker_run).should == 2
20
+ ensure
21
+ s.stop(true)
22
+ t.join
23
+ end
24
+ end
25
+ end
26
+ end
@@ -151,7 +151,7 @@ end
151
151
  module TestWorker
152
152
  def initialize
153
153
  incr_test_state :worker_initialize
154
- @stop_flag = BlockingFlag.new
154
+ @stop_flag = ServerEngine::BlockingFlag.new
155
155
  end
156
156
 
157
157
  def before_fork
@@ -180,6 +180,36 @@ module TestWorker
180
180
  def after_start
181
181
  incr_test_state :worker_after_start
182
182
  end
183
+
184
+ def spawn(pm)
185
+ script = <<-EOF
186
+ class WorkerClass
187
+ include TestWorker
188
+ def run
189
+ Thread.new do
190
+ command_pipe = STDIN.dup
191
+ STDIN.reopen(File::NULL)
192
+ Thread.new do
193
+ until @stop_flag.set?
194
+ cmd = command_pipe.gets.chomp
195
+ case cmd
196
+ when "GRACEFUL_STOP", "IMMEDIATE_STOP"
197
+ stop
198
+ when "RELOAD"
199
+ reload
200
+ end
201
+ end
202
+ end
203
+ end
204
+ super
205
+ end
206
+ end
207
+ $state_file_mutex = Mutex.new
208
+ WorkerClass.new.run
209
+ EOF
210
+ cmdline = [ServerEngine.ruby_bin_path] + %w[-rbundler/setup -rrspec -I. -Ispec -rserverengine -r] + [__FILE__] + %w[-e] + [script]
211
+ pm.spawn(*cmdline)
212
+ end
183
213
  end
184
214
 
185
215
  module RunErrorWorker
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0pre2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sigdump
@@ -128,6 +128,7 @@ files:
128
128
  - spec/daemon_logger_spec.rb
129
129
  - spec/daemon_spec.rb
130
130
  - spec/multi_process_server_spec.rb
131
+ - spec/multi_spawn_server_spec.rb
131
132
  - spec/server_worker_context.rb
132
133
  - spec/signal_thread_spec.rb
133
134
  - spec/socket_manager_spec.rb
@@ -148,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
149
  version: 2.1.0
149
150
  required_rubygems_version: !ruby/object:Gem::Requirement
150
151
  requirements:
151
- - - ">"
152
+ - - ">="
152
153
  - !ruby/object:Gem::Version
153
- version: 1.3.1
154
+ version: '0'
154
155
  requirements: []
155
156
  rubyforge_project:
156
157
  rubygems_version: 2.5.1
@@ -162,6 +163,7 @@ test_files:
162
163
  - spec/daemon_logger_spec.rb
163
164
  - spec/daemon_spec.rb
164
165
  - spec/multi_process_server_spec.rb
166
+ - spec/multi_spawn_server_spec.rb
165
167
  - spec/server_worker_context.rb
166
168
  - spec/signal_thread_spec.rb
167
169
  - spec/socket_manager_spec.rb