app/controllers/extface/handler_controller.rb in extface-0.0.6 vs app/controllers/extface/handler_controller.rb in extface-0.0.7

- old
+ new

@@ -20,20 +20,25 @@ Timeout.timeout(2) do if job = device.jobs.active.find_by(id: cookies[:extface]) || device.jobs.active.try(:first) cookies.permanent[:extface] = job.id p "Processing job #{job.id}" list, data = r.blpop(job.id, timeout: 1) + #TODO rescue here will loose data while data response.stream.write data r.publish(job.id, "OK") list, data = r.blpop(job.id, timeout: 1) end end end #timeout end #redis block end rescue => e - p "will continue next time #{e.message}" + if e.instance_of? Timeout::Error + p "will continue next time #{e.message}" + else + render nothing: true, status: :internal_server_error + end ensure response.stream.close end def push