Sha256: eaccad4440af348be5394d2e283c2d7afb44d7fa42cf8be79917f1c08c2d8959

Contents?: true

Size: 1.25 KB

Versions: 13

Compression:

Stored size: 1.25 KB

Contents

module Sidetiq
  class Supervisor < Celluloid::SupervisionGroup
    supervise Sidetiq::Actor::Clock, as: :sidetiq_clock

    if Sidekiq.server?
      if handler_pool_size = Sidetiq.config.handler_pool_size
        pool Sidetiq::Actor::Handler,
             as: :sidetiq_handler,
             size: handler_pool_size
      else
        # Use Celluloid's CPU-based default.
        pool Sidetiq::Actor::Handler,
             as: :sidetiq_handler
      end
    end

    class << self
      include Logging

      def clock
        run! if Celluloid::Actor[:sidetiq_clock].nil?
        Celluloid::Actor[:sidetiq_clock]
      end

      def handler
        run! if Celluloid::Actor[:sidetiq_handler].nil?
        Celluloid::Actor[:sidetiq_handler]
      end

      def run!
        motd
        info "Sidetiq::Supervisor start"
        super
      end

      def run
        raise "Sidetiq::Supervisor should not be run in foreground."
      end

      private

      def motd
        info "Sidetiq v#{VERSION::STRING} - Copyright (c) 2012-2013, Tobias Svensson <tob@tobiassvensson.co.uk>"
        info "Sidetiq is covered by the 3-clause BSD license."
        info "See LICENSE and http://opensource.org/licenses/BSD-3-Clause for licensing details."
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sidetiq-0.6.3 lib/sidetiq/supervisor.rb
sidetiq-0.6.2 lib/sidetiq/supervisor.rb
sidetiq-0.6.1 lib/sidetiq/supervisor.rb
sidetiq-0.6.0 lib/sidetiq/supervisor.rb
sidetiq-0.5.0 lib/sidetiq/supervisor.rb
sidetiq-0.4.3 lib/sidetiq/supervisor.rb
sidetiq-0.4.2 lib/sidetiq/supervisor.rb
sidetiq-0.4.1 lib/sidetiq/supervisor.rb
sidetiq-0.4.0 lib/sidetiq/supervisor.rb
sidetiq-0.4.0.rc4 lib/sidetiq/supervisor.rb
sidetiq-0.4.0.rc3 lib/sidetiq/supervisor.rb
sidetiq-0.4.0.rc2 lib/sidetiq/supervisor.rb
sidetiq-0.4.0.rc1 lib/sidetiq/supervisor.rb