We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
BACKPORT: Do not cache vendor Rails into a FrameworkSpawner. Instead, use 
ApplicationSpawner directly. This saves a bit of memory.
Hongli Lai (Phusion) (author)
Fri Aug 08 08:29:27 -0700 2008
commit  02d8e998b3cf1cbb766405725c7a5800eb9ad13c
tree    a2240c30980fde74d491ca10e13b3960176b2702
parent  e71cd54e027f4473aa9670c6dc156566989ad8c2
...
187
188
189
190
191
192
193
194
195
196
 
197
198
199
...
187
188
189
 
 
 
 
 
 
 
190
191
192
193
0
@@ -187,13 +187,7 @@ private
0
     if spawn_method == "smart"
0
       spawner_must_be_started = true
0
       framework_version = Application.detect_framework_version(app_root)
0
- if framework_version == :vendor
0
- vendor_path = normalize_path("#{app_root}/vendor/rails")
0
- key = "vendor:#{vendor_path}"
0
- create_spawner = proc do
0
- Railz::FrameworkSpawner.new(:vendor => vendor_path)
0
- end
0
- elsif framework_version.nil?
0
+ if framework_version.nil? || framework_version == :vendor
0
         app_root = normalize_path(app_root)
0
         key = "app:#{app_root}"
0
         create_spawner = proc do
...
45
46
47
 
 
 
 
 
 
 
 
48
49
50
...
162
163
164
165
 
166
167
168
...
173
174
175
176
177
 
 
178
179
180
...
333
334
335
336
 
337
338
339
...
45
46
47
48
49
50
51
52
53
54
55
56
57
58
...
170
171
172
 
173
174
175
176
...
181
182
183
 
 
184
185
186
187
188
...
341
342
343
 
344
345
346
347
0
@@ -45,6 +45,14 @@
0
     }
0
     return result;
0
   }
0
+
0
+ static Application::SessionPtr spawnRackApp(ApplicationPoolPtr pool, const char *appRoot) {
0
+ return pool->get(appRoot, true, "nobody", "production", "smart", "rack");
0
+ }
0
+
0
+ static Application::SessionPtr spawnWsgiApp(ApplicationPoolPtr pool, const char *appRoot) {
0
+ return pool->get(appRoot, true, "nobody", "production", "smart", "wsgi");
0
+ }
0
 
0
   TEST_METHOD(1) {
0
     // Calling ApplicationPool.get() once should return a valid Session.
0
@@ -162,7 +170,7 @@
0
     }
0
     
0
     void operator()() {
0
- m_session = pool->get("stub/minimal-railsapp");
0
+ m_session = spawnWsgiApp(pool, "stub/wsgi");
0
       m_done = true;
0
     }
0
   };
0
@@ -173,8 +181,8 @@
0
     // in the pool, then the pool will wait until enough sessions
0
     // have been closed.
0
     pool->setMax(2);
0
- Application::SessionPtr session1(pool->get("stub/railsapp"));
0
- Application::SessionPtr session2(pool2->get("stub/railsapp"));
0
+ Application::SessionPtr session1(spawnRackApp(pool, "stub/rack"));
0
+ Application::SessionPtr session2(spawnRackApp(pool2, "stub/rack"));
0
     Application::SessionPtr session3;
0
     bool done;
0
     
0
@@ -333,7 +341,7 @@
0
   TEST_METHOD(16) {
0
     // The cleaner thread should clean idle applications without crashing.
0
     pool->setMaxIdleTime(1);
0
- pool->get("stub/minimal-railsapp");
0
+ spawnRackApp(pool, "stub/rack");
0
     
0
     time_t begin = time(NULL);
0
     while (pool->getCount() == 1u && time(NULL) - begin < 10) {
...
29
30
31
 
32
33
34
...
29
30
31
32
33
34
35
0
@@ -29,6 +29,7 @@ module Rails
0
       if defined?(RAILS_ROOT)
0
         $LOAD_PATH << "#{RAILS_ROOT}/app/controllers"
0
       end
0
+ $LOAD_PATH << "#{RAILS_FRAMEWORK_ROOT}/railties/lib"
0
     end
0
   
0
   protected

Comments

    No one has commented yet.