Module: FireAndForget::Daemon

Defined in:
lib/fire_and_forget/daemon.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



8
9
10
11
12
# File 'lib/fire_and_forget/daemon.rb', line 8

def self.included(klass)
  FireAndForget.set_pid(self.task_name, $$)
rescue Errno::ECONNREFUSED
  # server isn't running but we don't want this to stop our script
end

.task_nameObject



4
5
6
# File 'lib/fire_and_forget/daemon.rb', line 4

def self.task_name
  ENV[FireAndForget::ENV_TASK_NAME]
end

Instance Method Details

#set_task_status(status) ⇒ Object



15
16
17
18
19
# File 'lib/fire_and_forget/daemon.rb', line 15

def set_task_status(status)
  FireAndForget.set_status(FireAndForget::Daemon.task_name, status)
rescue Errno::ECONNREFUSED
  # server isn't running but we don't want this to stop our script
end