Class: Procrastinate::ProcessManager::ChildProcess

Inherits:
Struct
  • Object
show all
Defined in:
lib/procrastinate/process_manager/child_process.rb

Overview

A <completion handler, result> tuple that stores the handler to call when a child exits and the object that will handle child-master communication if desired.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#handlerObject

Returns the value of attribute handler

Returns:

  • (Object)

    the current value of handler



5
6
7
# File 'lib/procrastinate/process_manager/child_process.rb', line 5

def handler
  @handler
end

#resultObject

Returns the value of attribute result

Returns:

  • (Object)

    the current value of result



5
6
7
# File 'lib/procrastinate/process_manager/child_process.rb', line 5

def result
  @result
end

#stateObject

Returns the value of attribute state

Returns:

  • (Object)

    the current value of state



5
6
7
# File 'lib/procrastinate/process_manager/child_process.rb', line 5

def state
  @state
end

Instance Method Details

#call_completion_handlersObject

Calls the completion handler for the child. This is triggered by the transition into the ‘dead’ state.



16
17
18
19
# File 'lib/procrastinate/process_manager/child_process.rb', line 16

def call_completion_handlers
  result.process_died if result
  handler.call if handler
end

#incoming_message(obj) ⇒ Object

Handles incoming messages from the tasks process.



23
24
25
# File 'lib/procrastinate/process_manager/child_process.rb', line 23

def incoming_message(obj)
  result.incoming_message(obj) if result
end