Permalink
Browse files

Merge "Catch exceptions inside blocks passed to fiber pools."

  • Loading branch information...
mpage Gerrit Code Review
mpage authored and Gerrit Code Review committed Sep 10, 2012
2 parents 91a631b + 2e1bedf commit f3158e1b7812cb1f6ab5cab734bfa9c08e79c565
@@ -3,12 +3,19 @@
NATS.subscribe('dea.advertise') do |msg|
begin
payload = Yajl::Parser.parse(msg, :symbolize_keys => true)
- CloudController::UTILITY_FIBER_POOL.spawn do
- DEAPool.process_advertise_message(payload)
- end
rescue => e
- CloudController.logger.error("Exception processing dea advertisement: '#{msg}'")
+ CloudController.logger.error("Failed parsing DEA advertisement #{msg} : #{e}")
CloudController.logger.error(e)
+ next
+ end
+
+ CloudController::UTILITY_FIBER_POOL.spawn do
+ begin
+ DEAPool.process_advertise_message(payload)
+ rescue => e
+ CloudController.logger.error("Failed processing dea advertisement: '#{msg}'")
+ CloudController.logger.error(e)
+ end
end
end
NATS.publish('dea.locate')
@@ -12,12 +12,19 @@
NATS.subscribe("cloudcontrollers.hm.requests.#{AppConfig[:cc_partition]}", :queue => :cc) do |msg|
begin
payload = Yajl::Parser.parse(msg, :symbolize_keys => true)
- CloudController::UTILITY_FIBER_POOL.spawn do
- App.process_health_manager_message(payload)
- end
rescue => e
- CloudController.logger.error("Exception processing health manager request: '#{msg}'")
+ CloudController.logger.error("Failed parsing HM request #{msg} : #{e}")
CloudController.logger.error(e)
+ next
+ end
+
+ CloudController::UTILITY_FIBER_POOL.spawn do
+ begin
+ App.process_health_manager_message(payload)
+ rescue => e
+ CloudController.logger.error("Failed processing HM request #{msg}: #{e}")
+ CloudController.logger.error(e)
+ end
end
end

0 comments on commit f3158e1

Please sign in to comment.