Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid refreshing gem list

I see the following statement while starting a rails app using unicorn, what does it do and how to avoid this:

I, [2013-03-28T06:46:05.060194 #1762]  INFO -- : worker=0 spawning...
I, [2013-03-28T06:46:05.066834 #2137]  INFO -- : worker=0 spawned pid=2137
I, [2013-03-28T06:46:05.067210 #2137]  INFO -- : Refreshing Gem list
like image 807
Rpj Avatar asked Mar 28 '13 07:03

Rpj


1 Answers

The log you present us contains:

worker=0 spawning

The worker that will answers your HTTP requests is spawned as a separate process, with the pid 2137.

Refreshing Gem list

According to the official Unicorn documentation (http://unicorn.bogomips.org/SIGNALS.html), the Gem set is reloaded in order so "updated code for your application can pick up newly installed RubyGems"

Looking at the source code, the message "Refreshing Gem list" is called whenever the application is built:

def build_app!
    if app.respond_to?(:arity) && app.arity == 0
      if defined?(Gem) && Gem.respond_to?(:refresh)
        logger.info "Refreshing Gem list"
        Gem.refresh
      end
      self.app = app.call
    end
  end
end

Setting the preload_app config provides some control over this behavior.

like image 163
Oct Avatar answered Oct 01 '22 16:10

Oct