diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-11-06 03:02:48 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-11-06 03:08:38 +0000 |
commit | fd023bafed0ad97e08d15381f35600e3a5b32808 (patch) | |
tree | 3bf21330c39c880b79d1256bfa5f9112cd355b41 | |
parent | df1506b0825a096514fcb3821563bf9e8fd52743 (diff) | |
download | rack-builder-map-to_app.tar.gz |
builder: avoid to_app on every request when using map builder-map-to_app
By calling to_app immediately after initializing the per-map Rack::Builder instances. Otherwise, benefits of warmup and web servers taking advantage of CoW are lost. This passes tests, and is lightly tested and I have not verified this for any negative consequences or incompatibilities.
-rw-r--r-- | lib/rack/builder.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rack/builder.rb b/lib/rack/builder.rb index fa3a1ea9..2aa37b68 100644 --- a/lib/rack/builder.rb +++ b/lib/rack/builder.rb @@ -157,7 +157,7 @@ module Rack def generate_map(default_app, mapping) mapped = default_app ? {'/' => default_app} : {} - mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b) } + mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b).to_app } URLMap.new(mapped) end end |