diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-02-10 16:42:05 +0100 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-02-10 16:42:05 +0100 |
commit | 1ea65758e446503c6202696580579ed1f994ce4e (patch) | |
tree | 33412cd02516a1de3ac8845d30dba0e09a15d9a0 | |
parent | 532ebf4d2e88b6ad982d5e4830a129f374f26bc6 (diff) |
cancel child task in begin rescue block
-rw-r--r-- | application.rb | 9 |
1 files changed, 8 insertions, 1 deletions
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 |