[Mongrel] Running some code right before the app is available to users

Zed Shaw zedshaw at zedshaw.com
Fri Aug 11 13:51:06 EDT 2006

On Fri, 2006-08-11 at 16:05 +0100, Pedro Côrte-Real wrote:
> I do some indexing using acts_as_ferret in a rails app. I need to do
> some preloading of the index's sort fields so that the first request
> that sorts doesn't take 5 minutes to complete. I tried sticking my
> preload code in config/environment.rb and that worked but it gets ran
> in rake migrations, tests, etc, when it's not really needed. Is there
> anything specific to starting up to serve requests I could check for?

You could put it in a mongrel.conf and just have Mongrel run it on

mongrel_rails start -S mongrel.conf

(Even though it ends in .conf it's actually Ruby code that gets run
inside the Configurator.)

Zed A. Shaw
http://www.railsmachine.com/ -- Need Mongrel support?

More information about the Mongrel-users mailing list