Method: BlackStack::Workmesh::Protocol#push

Defined in:
lib/workmesh.rb

#push(entity, node, l = nil) ⇒ Object

execute the push function of this protocol, and update the push flags



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/workmesh.rb', line 140

def push(entity, node, l=nil)
  l = BlackStack::DummyLogger.new(nil) if l.nil?
  raise 'The push function is not defined' if self.push_function.nil?
  entity[entity_field_push_time] = now()
  begin
    self.push_function.call(entity, node, l)
    entity[entity_field_push_success] = true
    entity[entity_field_push_error_description] = nil
    entity.save
  rescue => e
    entity[entity_field_push_success] = false
    entity[entity_field_push_error_description] = e.message
    entity.save
    raise e
  end
end