From 1ea65758e446503c6202696580579ed1f994ce4e Mon Sep 17 00:00:00 2001 From: mguetlein Date: Thu, 10 Feb 2011 16:42:05 +0100 Subject: cancel child task in begin rescue block --- application.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/application.rb b/application.rb index 47cafa5..289ce8d 100644 --- a/application.rb +++ b/application.rb @@ -173,7 +173,14 @@ put '/:id/:hasStatus/?' do #LOGGER.debug "Task " + params[:id].to_s + " set percentage completed to: "+params[:percentageCompleted].to_s end when /Cancelled|Error/ - OpenTox::Task.find(task.waiting_for).cancel if task.waiting_for and task.waiting_for.uri? + if task.waiting_for and task.waiting_for.uri? + # try cancelling the child task + begin + w = OpenTox::Task.find(task.waiting_for) + w.cancel if w.running? + rescue + end + end LOGGER.debug("Aborting task "+task.uri.to_s) Process.kill(9,task.pid) unless task.pid.nil? task.pid = nil -- cgit v1.2.3