Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Merge "Catch exceptions inside blocks passed to fiber pools."
Browse files Browse the repository at this point in the history
  • Loading branch information
mpage authored and Gerrit Code Review committed Sep 10, 2012
2 parents 91a631b + 2e1bedf commit f3158e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
15 changes: 11 additions & 4 deletions cloud_controller/app/subscriptions/dea_advertise_channel.rb
Expand Up @@ -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')
Expand Down
15 changes: 11 additions & 4 deletions cloud_controller/app/subscriptions/health_manager_channel.rb
Expand Up @@ -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

Expand Down

0 comments on commit f3158e1

Please sign in to comment.