Sha256: 67129c061a4369e7674701ae6b7681599b92d2f64a0ee5760ecfa5382a63c9bf

Contents?: true

Size: 965 Bytes

Versions: 26

Compression:

Stored size: 965 Bytes

Contents

# encoding: utf-8
module Mutx
  module BackgroundJobs
    class Sidekiq
      def self.start

        workers_dir = workers_dir = __FILE__.split("/")[0..-2].join("/")+ "/workers"

        Mutx::Support::Console.execute "sidekiq -r #{workers_dir}/executor.rb -d -L mutx/logs/sidekiq.log -P mutx/sidekiq_pid"

        print "\n* Sidekiq:"
        raise "Could not start Sidekiq correctly. Read mutx/logs/sidekiq.log file for more information" if not started?

        print " Started!\n"
      end

      # Existance of pid file means that sidekiq was started
      def self.started?
        begin
          sec = 0
          begin
            print "."
            return true if IO.read("#{Dir.pwd}/mutx/logs/sidekiq.log") =~ /INFO: Booting Sidekiq \d+.\d+.\d+ with redis options {/
            sec += sleep 1
          end until sec == 10

          puts "Sidekiq not started"
          false

        rescue
          false
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
mutx-0.1.31 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.30 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.29 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.28 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.27 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.26 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.25 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.24 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.23 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.22 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.21 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.20 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.19 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.18 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.17 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.16 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.15 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.14 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.13 lib/mutx/background_jobs/sidekiq.rb
mutx-0.1.12 lib/mutx/background_jobs/sidekiq.rb