Module: Workerholic

Defined in:
lib/workerholic.rb,
lib/workerholic/cli.rb,
lib/workerholic/job.rb,
lib/workerholic/queue.rb,
lib/workerholic/worker.rb,
lib/workerholic/manager.rb,
lib/workerholic/starter.rb,
lib/workerholic/storage.rb,
lib/workerholic/version.rb,
lib/workerholic/job_retry.rb,
lib/workerholic/sorted_set.rb,
lib/workerholic/job_wrapper.rb,
lib/workerholic/log_manager.rb,
lib/workerholic/job_processor.rb,
lib/workerholic/job_scheduler.rb,
lib/workerholic/job_serializer.rb,
lib/workerholic/job_statistics.rb,
lib/workerholic/statistics_api.rb,
lib/workerholic/worker_balancer.rb,
lib/workerholic/statistics_storage.rb

Defined Under Namespace

Modules: Job Classes: CLI, JobProcessor, JobRetry, JobScheduler, JobSerializer, JobStatistics, JobWrapper, LogManager, Manager, Queue, SortedSet, Starter, StatsAPI, StatsStorage, Storage, Worker, WorkerBalancer

Constant Summary collapse

PIDS =
[Process.pid]
REDIS_URL =
ENV['REDIS_URL'] || 'redis://localhost:' + ($TESTING ? '1234' : '6379')
VERSION =
'0.1.2'

Class Method Summary collapse

Class Method Details

.managerObject



64
65
66
# File 'lib/workerholic.rb', line 64

def self.manager
  @manager
end

.manager=(mgr) ⇒ Object



60
61
62
# File 'lib/workerholic.rb', line 60

def self.manager=(mgr)
  @manager = mgr
end

.redis_connections_countObject



45
46
47
# File 'lib/workerholic.rb', line 45

def self.redis_connections_count
  @redis_connections_count || (workers_count + 3)
end

.redis_connections_count=(num) ⇒ Object

Raises:

  • (ArgumentError)


49
50
51
52
# File 'lib/workerholic.rb', line 49

def self.redis_connections_count=(num)
  raise ArgumentError unless num.is_a?(Integer) && num < 200
  @redis_connections_count = num
end

.redis_poolObject



54
55
56
57
58
# File 'lib/workerholic.rb', line 54

def self.redis_pool
  @redis ||= ConnectionPool.new(size: redis_connections_count, timeout: 5) do
    Redis.new(url: REDIS_URL)
  end
end

.workers_countObject



36
37
38
# File 'lib/workerholic.rb', line 36

def self.workers_count
  @workers_count || 25
end

.workers_count=(num) ⇒ Object

Raises:

  • (ArgumentError)


40
41
42
43
# File 'lib/workerholic.rb', line 40

def self.workers_count=(num)
  raise ArgumentError unless num.is_a?(Integer) && num < 200
  @workers_count = num
end