Skip to content
This repository
Browse code

Fixed a bug where we couldn't resubscribe to a previously unsubscribe…

…d queue
  • Loading branch information...
commit 61810b56394f6a463362bbeda7b7e888b2287e76 1 parent 0f8e4f6
Metallion authored

Showing 1 changed file with 8 additions and 7 deletions. Show diff stats Hide diff stats

  1. +8 7 dcmgr/lib/dcmgr/node_modules/service_netfilter.rb
15 dcmgr/lib/dcmgr/node_modules/service_netfilter.rb
@@ -376,19 +376,20 @@ class ServiceNetfilter < Isono::NodeModules::Base
376 376 end
377 377
378 378 def subscribe_to_event(ev,&blk)
379   - begin
  379 + @subscribed_events = [] if @subscribed_events.nil?
  380 + unless @subscribed_events.member?(ev)
380 381 event.subscribe(ev,'#',&blk)
  382 + @subscribed_events << ev
381 383 logger.debug("Subscribing to: #{ev}")
382   - rescue AMQP::Error => e
383   - # Do nothing if we're already subscribed to this queue
384   - raise unless e.message == "already subscribed to the queue"
385   - #logger.debug("Already subscribed to: #{ev}")
386 384 end
387 385 end
388 386
389 387 def unsubscribe_from_event(ev)
390   - logger.debug("Unsubscribing from: #{ev}")
391   - event.unsubscribe(ev)
  388 + if @subscribed_events.member?(ev)
  389 + logger.debug("Unsubscribing from: #{ev}")
  390 + @subscribed_events.delete(ev)
  391 + event.unsubscribe(ev)
  392 + end
392 393 end
393 394
394 395 def subscribe_to_referenced_security_group(ref_group_id)

0 comments on commit 61810b5

Please sign in to comment.
Something went wrong with that request. Please try again.