serverengine 2.0.0pre2-x64-mingw32 → 2.0.0-x64-mingw32

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: b6aea495673654ab1b6b6abab49b42a8cb391846
4
- data.tar.gz: e599bace23f6aeb747bd41b07015a61c3a9375bb
3
+ metadata.gz: fc9132a1f17c81e3e27941d39f13af8cd9128e46
4
+ data.tar.gz: cd916f65f94fe84bda74de0522ec1fcefddba741
5
5
  SHA512:
6
- metadata.gz: d35e191adcdad84cd1c1d52e4e257844220b7a5aa4226ba879dda925b762fb6aa5d53215c6bbf2a7a752c141ebe16240925267f2b456d3735b20a01cd52576fa
7
- data.tar.gz: e54be82f1a874c9731535d93c0182d90463a7908d6af175653888552f062b94c804ff014669fec567f9e66847b0037861a4603592222067bdc00b80aac8a5205
6
+ metadata.gz: cdd4e62a9ae5001e77a99c339f1574019b61e4dc9c3c24a80607be676010453158fcb8e45406020ae6b080809f06f7f5ec3f5138c0951d48db692cd64b83752e
7
+ data.tar.gz: 49ecbcaef19a945df4a92637b15c23b63982fab635dec088713fbd4d686fffc50b029881b16da363f64d7bf94c0b76c2b57b658e4fa0e2a7067971cb5d853eee
@@ -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: x64-mingw32
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
@@ -142,6 +142,7 @@ files:
142
142
  - spec/daemon_logger_spec.rb
143
143
  - spec/daemon_spec.rb
144
144
  - spec/multi_process_server_spec.rb
145
+ - spec/multi_spawn_server_spec.rb
145
146
  - spec/server_worker_context.rb
146
147
  - spec/signal_thread_spec.rb
147
148
  - spec/socket_manager_spec.rb
@@ -162,9 +163,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
163
  version: 2.1.0
163
164
  required_rubygems_version: !ruby/object:Gem::Requirement
164
165
  requirements:
165
- - - ">"
166
+ - - ">="
166
167
  - !ruby/object:Gem::Version
167
- version: 1.3.1
168
+ version: '0'
168
169
  requirements: []
169
170
  rubyforge_project:
170
171
  rubygems_version: 2.5.1
@@ -176,6 +177,7 @@ test_files:
176
177
  - spec/daemon_logger_spec.rb
177
178
  - spec/daemon_spec.rb
178
179
  - spec/multi_process_server_spec.rb
180
+ - spec/multi_spawn_server_spec.rb
179
181
  - spec/server_worker_context.rb
180
182
  - spec/signal_thread_spec.rb
181
183
  - spec/socket_manager_spec.rb