diff -u -r mongrel-1.0.1.orig/lib/mongrel/rails.rb mongrel-1.0.1/lib/mongrel/rails.rb
--- mongrel-1.0.1.orig/lib/mongrel/rails.rb	2007-02-07 13:00:27.000000000 -0800
+++ mongrel-1.0.1/lib/mongrel/rails.rb	2007-02-15 01:52:55.000000000 -0800
@@ -33,6 +33,8 @@
       attr_reader :files
       attr_reader :guard
       @@file_only_methods = ["GET","HEAD"]
+      @@file_dep_info = {}
+      @@restart_in_n_requests = nil
 
       def initialize(dir, mime_map = {})
         @files = Mongrel::DirHandler.new(dir,false)
@@ -43,6 +45,50 @@
         mime_map.each {|k,v| Mongrel::DirHandler::add_mime_type(k,v) }
       end
 
+
+      def check_rails_dependencies
+        if @@restart_in_n_requests
+          if @@restart_in_n_requests == 0 
+            Process.kill("USR2", Process.pid)
+          end
+          
+          @@restart_in_n_requests -= 1
+          return
+        end
+
+
+        deps = Dependencies.loaded + ["database.yml", "config.yml"]
+      
+        deps.each { |d|
+          path = nil
+
+          if @@file_dep_info[d]
+            path = @@file_dep_info[d][:path]
+            if path
+              new_mod = File.stat(path).mtime
+              if new_mod > @@file_dep_info[d][:mod_time] && !@@restart_in_n_requests
+                @@restart_in_n_requests = rand(20)
+                STDERR.puts "#{path} has changed, restarting in #{@@restart_in_n_requests} requests\n"
+                return
+              end
+            end
+          else
+            mod_time = nil
+
+            $LOAD_PATH.each { |p|
+              test = (d =~ /\.yml$/) ? "#{p}/#{d}" : "#{p}/#{d}.rb"
+              if File.exist?(test)
+                path = test
+                break
+              end
+            }
+    
+            mod_time = File.stat(path).mtime if path            
+            @@file_dep_info[d] = {:path => path, :mod_time => mod_time}
+          end
+        }
+      end
+
       # Attempts to resolve the request as follows:
       #
       # * If the requested exact PATH_INFO exists as a file then serve it.
@@ -88,6 +134,8 @@
             STDERR.puts rails_error.backtrace.join("\n")
           end
         end
+
+        check_rails_dependencies  
       end
 
       def log_threads_waiting_for(event)
diff -u -r mongrel-1.0.1.orig/lib/mongrel.rb mongrel-1.0.1/lib/mongrel.rb
--- mongrel-1.0.1.orig/lib/mongrel.rb	2007-02-07 13:00:27.000000000 -0800
+++ mongrel-1.0.1/lib/mongrel.rb	2007-02-07 14:52:49.000000000 -0800
@@ -564,7 +564,7 @@
       @workers = ThreadGroup.new
       @timeout = timeout
       @num_processors = num_processors
-      @death_time = 60
+      @death_time = 60 * 15
     end
 
     # Does the majority of the IO processing.  It has been written in Ruby using
@@ -686,8 +686,8 @@
     # that much longer.
     def graceful_shutdown
       while reap_dead_workers("shutdown") > 0
-        STDERR.print "Waiting for #{@workers.list.length} requests to finish, could take #{@death_time + @timeout} seconds."
-        sleep @death_time / 10
+        STDERR.print "Waiting for #{@workers.list.length} requests to finish, could take #{@death_time + @timeout} seconds.\n"
+        sleep 1
       end
     end
 
