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 !
Fix some Rails compatibility problems. Use smaller cleanup idle times for 
ApplicationSpawners in SpawnManager.
Hongli Lai (Phusion) (author)
Mon Mar 31 07:03:48 -0700 2008
commit  82065691567e2108c142b5743bc1a724907a6aa7
tree    2b6fad44415499e3dd76adea7568893f407b96c9
parent  fb3946d301fe22845830c99d66266c111092c437
...
219
220
221
 
 
 
222
223
224
...
219
220
221
222
223
224
225
226
227
0
@@ -219,6 +219,9 @@ private
0
       Rails::Initializer.run(:set_load_path)
0
     end
0
     require 'config/environment'
0
+ if !defined?(Dispatcher)
0
+ require 'dispatcher'
0
+ end
0
     require_dependency 'application'
0
     Dir.glob('app/{models,controllers,helpers}/*.rb').each do |file|
0
       require_dependency normalize_path(file)
...
37
38
39
40
41
 
42
43
44
...
37
38
39
 
40
41
42
43
44
0
@@ -37,8 +37,8 @@ end
0
 # *Note*: FrameworkSpawner may only be started asynchronously with AbstractServer#start.
0
 # Starting it synchronously with AbstractServer#start_synchronously has not been tested.
0
 class FrameworkSpawner < AbstractServer
0
- APP_SPAWNER_CLEAN_INTERVAL = 125
0
   APP_SPAWNER_MAX_IDLE_TIME = 120
0
+ APP_SPAWNER_CLEAN_INTERVAL = APP_SPAWNER_MAX_IDLE_TIME + 5
0
 
0
   include Utils
0
   
...
21
22
23
24
25
 
 
 
 
26
27
28
...
94
95
96
97
 
98
99
100
...
212
213
214
215
 
 
 
 
 
 
216
217
218
...
21
22
23
 
 
24
25
26
27
28
29
30
...
96
97
98
 
99
100
101
102
...
214
215
216
 
217
218
219
220
221
222
223
224
225
0
@@ -21,8 +21,10 @@ module Passenger
0
 # finished.
0
 class SpawnManager < AbstractServer
0
   DEFAULT_INPUT_FD = 3
0
- SPAWNER_CLEAN_INTERVAL = 30 * 60
0
- SPAWNER_MAX_IDLE_TIME = 29 * 60
0
+ FRAMEWORK_SPAWNER_MAX_IDLE_TIME = 30 * 60
0
+ APP_SPAWNER_MAX_IDLE_TIME = FrameworkSpawner::APP_SPAWNER_MAX_IDLE_TIME
0
+ SPAWNER_CLEAN_INTERVAL = [FRAMEWORK_SPAWNER_MAX_IDLE_TIME,
0
+ APP_SPAWNER_MAX_IDLE_TIME].min + 5
0
   
0
   include Utils
0
   
0
@@ -94,7 +96,7 @@ class SpawnManager < AbstractServer
0
       return spawner.spawn_application(app_root, lower_privilege,
0
         lowest_user)
0
     else
0
- return spawner.spawn_application(app_root)
0
+ return spawner.spawn_application
0
     end
0
   end
0
   
0
@@ -212,7 +214,12 @@ private
0
           current_time = Time.now
0
           @spawners.keys.each do |key|
0
             spawner = @spawners[key]
0
- if current_time - spawner.time > SPAWNER_MAX_IDLE_TIME
0
+ if spawner.is_a?(FrameworkSpawner)
0
+ max_idle_time = FRAMEWORK_SPAWNER_MAX_IDLE_TIME
0
+ else
0
+ max_idle_time = APP_SPAWNER_MAX_IDLE_TIME
0
+ end
0
+ if current_time - spawner.time > max_idle_time
0
               spawner.stop
0
               @spawners.delete(key)
0
             end

Comments

    No one has commented yet.