def self.do_action(context, msg)
fei = msg['fei']
action = msg['action']
if action == 'reply' && fei['engine_id'] != context.engine_id
engine_participant =
context.plist.lookup(fei['engine_id'], msg['workitem'])
raise(
"no EngineParticipant found under name '#{fei['engine_id']}'"
) unless engine_participant
engine_participant.reply(fei, msg['workitem'])
return
end
fexp = nil
n = context.storage.class.name.match(/Couch/) ? 3 : 1
n.times do |i|
if fexp = fetch(context, msg['fei']); break; end
sleep 0.028 unless i == (n - 1)
end
fexp.do(action, msg) if fexp
end