Module: FakeGoUp

Defined in:
lib/fake_go_up.rb,
lib/fake_go_up/task.rb,
lib/fake_go_up/version.rb

Defined Under Namespace

Classes: Task

Constant Summary collapse

VERSION =
"0.0.0"
@@redis =
nil

Class Method Summary collapse

Class Method Details

._runObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fake_go_up.rb', line 21

def _run
  tasks = FakeGoUp::Task.subclasses.map(&:new)
  while true
    all_finish = true

    tasks.each do |task|
      task.go_up
      all_finish = false unless task.all_finish?
    end

    break if all_finish
    sleep(1)
  end
end

.redisObject



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

def redis
  @@redis
end

.redis=(conn) ⇒ Object



9
10
11
# File 'lib/fake_go_up.rb', line 9

def redis=(conn)
  @@redis = conn
end

.runObject



13
14
15
16
17
18
19
# File 'lib/fake_go_up.rb', line 13

def run
  pid_name = "FakeGoUp"
  return if PidLock.locked?(pid_name)
  PidLock.lock(pid_name)
  _run
  PidLock.unlock(pid_name)
end