rack-fiber_pool 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ The new homepage is
2
+ [https://github.com/alebsack/rack-fiber_pool](https://github.com/alebsack/rack-fiber_pool)
3
+
1
4
  rack-fiber_pool
2
5
  ---------------
3
6
 
@@ -57,6 +60,12 @@ Thanks to
57
60
  Eric Wong - for adding explicit support for Rack::FiberPool to rainbows.
58
61
 
59
62
 
63
+ Changes
64
+ ==========
65
+
66
+ 0.9.3 - fix incompatibility with sinatra streaming, new maintainer (alebsack)
67
+
68
+
60
69
  Author
61
70
  ======
62
71
 
@@ -2,7 +2,7 @@ require 'fiber_pool'
2
2
 
3
3
  module Rack
4
4
  class FiberPool
5
- VERSION = '0.9.2'
5
+ VERSION = '0.9.3'
6
6
  SIZE = 100
7
7
 
8
8
  # The size of the pool is configurable:
@@ -11,17 +11,18 @@ module Rack
11
11
  def initialize(app, options={})
12
12
  @app = app
13
13
  @fiber_pool = ::FiberPool.new(options[:size] || SIZE)
14
- @rescue_exception = options[:rescue_exception] || Proc.new { |env, e| [500, {}, "#{e.class.name}: #{e.message.to_s}"] }
14
+ @rescue_exception = options[:rescue_exception] || Proc.new { |env, e| [500, {}, ["#{e.class.name}: #{e.message.to_s}"]] }
15
15
  yield @fiber_pool if block_given?
16
16
  end
17
17
 
18
18
  def call(env)
19
19
  call_app = lambda do
20
+ env['async.orig_callback'] = env.delete('async.callback')
20
21
  begin
21
22
  result = @app.call(env)
22
- env['async.callback'].call result
23
+ env['async.orig_callback'].call result
23
24
  rescue ::Exception => e
24
- env['async.callback'].call @rescue_exception.call(env, e)
25
+ env['async.orig_callback'].call @rescue_exception.call(env, e)
25
26
  end
26
27
  end
27
28
 
@@ -23,22 +23,22 @@ class TestRackFiberPool < MiniTest::Unit::TestCase
23
23
  catch :async do
24
24
  res = Rack::MockRequest.new(Rack::FiberPool.new(app)).get("/")
25
25
  end
26
- assert_equal [500, {}, "Exception: I'm buggy! Please fix me."], app.result
26
+ assert_equal [500, {}, ["Exception: I'm buggy! Please fix me."]], app.result
27
27
  end
28
28
 
29
29
  def test_custom_rescue_exception
30
30
  app = TestBuggyApp.new
31
31
  catch :async do
32
- rescue_exception = Proc.new { |env, exception| [503, {}, exception.message] }
32
+ rescue_exception = Proc.new { |env, exception| [503, {}, [exception.message]] }
33
33
  res = Rack::MockRequest.new(Rack::FiberPool.new(app, :rescue_exception => rescue_exception)).get('/')
34
34
  end
35
- assert_equal [503, {}, "I'm buggy! Please fix me."], app.result
35
+ assert_equal [503, {}, ["I'm buggy! Please fix me."]], app.result
36
36
  end
37
37
 
38
38
  class TestBuggyApp
39
39
  attr_accessor :result
40
40
  def call(env)
41
- env['async.callback'] = proc { |result| @result = result }
41
+ env['async.orig_callback'] = proc { |result| @result = result }
42
42
  raise Exception.new("I'm buggy! Please fix me.")
43
43
  end
44
44
  end
@@ -46,7 +46,7 @@ class TestRackFiberPool < MiniTest::Unit::TestCase
46
46
  class TestApp
47
47
  attr_accessor :result
48
48
  def call(env)
49
- env['async.callback'] = proc { |result| @result = result }
49
+ env['async.orig_callback'] = proc { |result| @result = result }
50
50
  [200, {"Content-Type" => "text/plain"}, ["Hello world!"]]
51
51
  end
52
52
  end
metadata CHANGED
@@ -1,19 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-fiber_pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mike Perham
9
+ - Adam Lebsack
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2011-08-24 00:00:00.000000000 -07:00
13
- default_executable:
13
+ date: 2013-03-19 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Rack middleware to run each request within a Fiber
16
- email: mperham@gmail.com
16
+ email:
17
+ - mperham@gmail.com
18
+ - alebsack@gmail.com
17
19
  executables: []
18
20
  extensions: []
19
21
  extra_rdoc_files: []
@@ -26,8 +28,7 @@ files:
26
28
  - lib/rack/fiber_pool.rb
27
29
  - test/helper.rb
28
30
  - test/test_rack-fiber_pool.rb
29
- has_rdoc: true
30
- homepage: http://github.com/mperham/rack-fiber_pool
31
+ homepage: http://github.com/alebsack/rack-fiber_pool
31
32
  licenses: []
32
33
  post_install_message:
33
34
  rdoc_options:
@@ -48,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
49
  version: '0'
49
50
  requirements: []
50
51
  rubyforge_project:
51
- rubygems_version: 1.6.2
52
+ rubygems_version: 1.8.25
52
53
  signing_key:
53
54
  specification_version: 3
54
55
  summary: Rack middleware to run each request within a Fiber