Skip to content
Snippets Groups Projects
Commit f0e4dbb2 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

draft: fixes #4

parent 51fd0343
No related branches found
No related tags found
No related merge requests found
Pipeline #63438 failed with stages
in 1 minute and 3 seconds
......@@ -192,9 +192,6 @@ class Declarer(Channeler, Synchronized):
Channeler.__init__(self)
Synchronized.__init__(self)
self.cluster = cluster
self.declared = set() # since Queues and Exchanges are hashable...
# anonymous queues aren't, but we reject those
# persistent
self.left_to_declare = collections.deque() # since last disconnect. persistent+transient
# deque of Operation objects
......@@ -219,10 +216,6 @@ class Declarer(Channeler, Synchronized):
while len(self.left_to_declare) > 0:
self.left_to_declare.pop().on_connection_dead()
# recast current declarations as new operations
for dec in self.declared:
self.left_to_declare.append(Operation(self, dec))
super(Declarer, self).on_close()
return
......@@ -267,7 +260,7 @@ class Declarer(Channeler, Synchronized):
return fut
def declare(self, obj, persistent=False, span=None):
def declare(self, obj, span=None):
"""
Schedule to have an object declared.
......@@ -280,11 +273,7 @@ class Declarer(Channeler, Synchronized):
Queue declarations CAN fail.
Note that if re-declaring these fails, they will be silently discarded.
You can subscribe an on_discard(Exchange | Queue) here.
:param obj: Exchange or Queue instance
:param persistent: will be redeclared upon disconnect. To remove, use "undeclare"
:param span: span if opentracing is installed
:return: a Future instance
:raise ValueError: tried to declare anonymous queue
......@@ -298,10 +287,6 @@ class Declarer(Channeler, Synchronized):
fut = Future()
fut.set_running_or_notify_cancel()
if persistent:
if obj not in self.declared:
self.declared.add(obj)
self.left_to_declare.append(Operation(self, obj, fut, span, enqueued_span))
self._do_operations()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment