Yeah, it is a vestige. I will turn it into a function. This comment in
config/rainbows.rb explains the strategy:

Rainbows! do
  use :EventMachine # concurrency model to use
  worker_connections 400
  keepalive_timeout 5 # zero disables keepalives entirely
  client_max_body_size 5*1024*1024 # 5 megabytes

  if workers_have_agent
    Rainbows.module_eval do
      class << self; alias :quit_without_agent! :quit!; end
      def self.quit!
        # First tell rainbows to quit so that stop accepting API requests,
        # then stop the agent gracefully and let it call EM.stop to cause
        # process termination, but in the meantime while gracefully stopping
        # rainbows will be calling this method every second, so need to
avoid
        # calling stop twice or it will abort the graceful termination
        quit_without_agent!
        RightScale::RainbowsAgentController.stop unless @stopping
        @stopping = true
      end
    end
  end
end


On Fri, Jan 17, 2014 at 11:40 AM, Tony Spataro <notifications@github.com>wrote:

> In lib/right_agent/agent.rb:
>
> >        @stats_routing_key = "stats.#{@agent_type}.#{parsed_identity.base_id}"
> > +      @terminate_callback = TERMINATE_BLOCK
>
> Seems like TERMINATE_BLOCK could become a method, and @terminate_callback
> could disappear, now that we unconditionally call that block on shutdown.
>
> (Random aside: how does this terminate block work with Rainbows graceful
> shutdown, where we didn't start the EM reactor? I'm sure that case is
> covered, just curious.)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/rightscale/right_agent/pull/99/files#r8977654>
> .
>