spider-gazelle 2.0.2 → 2.0.3

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: ce0882fd3ec8b1ae9319cff47eb1ed6504b18c2e
4
- data.tar.gz: 9ac4f207d5fb67c773ae7775d42f61b1dfc8a309
3
+ metadata.gz: aa54ad709c599040952a6b5eb3b7828588c189a3
4
+ data.tar.gz: 29590d95bfbe05eee8d103360c9f2c8fd23e864b
5
5
  SHA512:
6
- metadata.gz: 0cc6c0b91aaf2dd1299267df06682ea445f5d2b5811a41f83cdb708f5032805513dff7c7872371f982106154e7d5dcbe7f08d76c4506a5064b3fdc5f044cae19
7
- data.tar.gz: cfd13c84de17f19f91832a9e29caef019c329cabf6b29de0255512f512b66ba2a44e0128598153c92e80ce3498687f9b8eddd7cc6c6fc810dda763c62393c3f8
6
+ metadata.gz: dce6e2a81089ff0236b07d438e210975d78470e8da3055ab061998aab0f70bd2f87d0df4ce01ba51c15ff4b67b8fb8e7245c90e6b36620ef240dda6f7a7e7970
7
+ data.tar.gz: 4392fac11db9220e2252e8f04c78c8d9d0c720341b8777131f420b991c43ba8b77306f30440959cae03944213937c2e33d78b6fbfe305e501d096efb2e533f18
@@ -78,7 +78,6 @@ module SpiderGazelle
78
78
  @thread = thread
79
79
  @logger = logger
80
80
 
81
- @work = method(:work)
82
81
  @work_complete = proc { |request, result|
83
82
  if request.is_async && !request.hijacked
84
83
  if result.is_a?(Fixnum) && !request.defer.resolved?
@@ -162,6 +161,9 @@ module SpiderGazelle
162
161
  # @mode = nil
163
162
  # @scheme = nil
164
163
 
164
+ if @processing
165
+ @processing.defer.reject(:socket_closed)
166
+ end
165
167
  @processing = nil
166
168
  @transmitting = nil
167
169
 
@@ -222,18 +224,18 @@ module SpiderGazelle
222
224
  end
223
225
 
224
226
  WORKER_ERROR = proc { |error|
225
- @logger.print_error error, 'critical error'
227
+ Logger.instance.print_error error, 'critical error'
226
228
  Reactor.instance.shutdown
227
229
  }
228
230
  def exec_on_thread_pool
229
- promise = @thread.work @work
231
+ request = @processing
232
+ promise = @thread.work { work(request) }
230
233
  promise.then @work_complete
231
234
  promise.catch WORKER_ERROR
232
235
  end
233
236
 
234
237
  EMPTY_RESPONSE = [''.freeze].freeze
235
- def work
236
- request = @processing
238
+ def work(request)
237
239
  begin
238
240
  [request, request.execute!]
239
241
  rescue StandardError => e
@@ -299,6 +299,7 @@ module SpiderGazelle
299
299
 
300
300
  @options.each_index do |id|
301
301
  options = @options[id]
302
+ @logger.verbose { "Loading rackup #{options}" }
302
303
  iterator = @iterators[options[:mode]]
303
304
 
304
305
  binding = @bindings[options[:port]] = Binding.new(iterator, id.to_s, options)
@@ -1,5 +1,5 @@
1
1
 
2
2
  module SpiderGazelle
3
- VERSION = '2.0.2'.freeze
3
+ VERSION = '2.0.3'.freeze
4
4
  EXEC_NAME = 'sg'.freeze
5
5
  end
data/spec/http1_spec.rb CHANGED
@@ -32,7 +32,21 @@ class MockLogger
32
32
 
33
33
  def method_missing(methId, *args)
34
34
  @logged << methId
35
- p "methId: #{args}"
35
+ p "#{methId}: #{args}"
36
+ end
37
+
38
+ def print_error(e, msg = '', trace = nil)
39
+ @logged << msg << ': ' << e
40
+ msg << ":\n" unless msg.empty?
41
+ msg << "#{e.message}\n"
42
+ backtrace = e.backtrace if e.respond_to?(:backtrace)
43
+ if backtrace
44
+ msg << "#{backtrace.join("\n")}\n"
45
+ elsif trace.nil?
46
+ trace = caller
47
+ end
48
+ msg << "Caller backtrace:\n#{trace.join("\n")}\n" if trace
49
+ puts msg
36
50
  end
37
51
  end
38
52
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spider-gazelle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen von Takach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2016-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.4.6
194
+ rubygems_version: 2.5.1
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: A fast, parallel and concurrent web server for ruby