lib/junkie/pyload/observer.rb in junkie-0.0.7 vs lib/junkie/pyload/observer.rb in junkie-0.0.8

- old
+ new

@@ -111,25 +111,33 @@ # # # It monitors the download process and reacts depending on the results # def monitor_progress log.debug("Watchdog timer has been fired") in_fiber { - catch(:break) { - queue_data = get_queue_data + catch(:break) do - # check for empty queue and disable watchdog if needed - check_for_empty_queue(queue_data) + begin + queue_data = get_queue_data - # extract package IDs and map them to current downloads - update_package_ids(queue_data) + # check for empty queue and disable watchdog if needed + check_for_empty_queue(queue_data) - check_for_failed_links(queue_data) + # extract package IDs and map them to current downloads + update_package_ids(queue_data) - check_for_complete_packages(queue_data) - } + check_for_failed_links(queue_data) + + check_for_complete_packages(queue_data) + + rescue Junkie::InvalidResponse => e + log.error( + "Pyload returns InvalidResponse (#{e}), I will ignore this") + rescue Exception => e + log.error( + "an unexpected error is occured (#{e}), I will ignore this") + end + end } - rescue Junkie::InvalidResponse => e - log.error("Pyload returns InvalidResponse (#{e}), I will ignore this") end # Checks if the Pyload Queue is empty and disables the watchdog if # it is really real