Class: Resque::Cluster::Member

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/cluster/member.rb

Overview

Member is a single member of a resque pool cluster

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(started_pool) ⇒ Member

Returns a new instance of Member.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/resque/cluster/member.rb', line 10

def initialize(started_pool)
  @pool = started_pool
  @config = Config.new(Cluster.config[:local_config_path], Cluster.config[:global_config_path])
  if @config.verified?
    @config.log_warnings
    @worker_count_manager = initialize_gru
  else
    @config.log_errors
    @pool.quit
  end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/resque/cluster/member.rb', line 8

def config
  @config
end

#poolObject (readonly)

Returns the value of attribute pool.



8
9
10
# File 'lib/resque/cluster/member.rb', line 8

def pool
  @pool
end

Instance Method Details

#check_for_worker_count_adjustmentObject



31
32
33
34
35
# File 'lib/resque/cluster/member.rb', line 31

def check_for_worker_count_adjustment
  return unless gru_is_inititalized?
  host_count_adjustment = @worker_count_manager.adjust_workers
  adjust_worker_counts(host_count_adjustment) if host_count_adjustment
end

#performObject



22
23
24
# File 'lib/resque/cluster/member.rb', line 22

def perform
  check_for_worker_count_adjustment
end

#unregisterObject



26
27
28
29
# File 'lib/resque/cluster/member.rb', line 26

def unregister
  remove_counts
  unqueue_all_workers
end