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

added extra __slots__ in Declarer

parent 0b7f2380
No related branches found
No related tags found
No related merge requests found
Pipeline #62145 failed with stages
in 17 seconds
......@@ -7,4 +7,5 @@ Since v1.3.2 they'll be put here and in release description.
* compile_definitions will now depend on requests
* added support for infinite (None) timeouts during start
* stress tests will run for 120 seconds now
* stress tests will be harder, and use more queues
\ No newline at end of file
* stress tests will be harder, and use more queues
* added extra __slots__ in Declarer
\ No newline at end of file
__version__ = '1.3.2b3'
__version__ = '1.3.2b4'
......@@ -150,6 +150,9 @@ class Operation(object):
class DeleteQueue(Operation):
__slots__ = ()
def __init__(self, declarer, queue, fut, span_parent=None, span_enqueued=None):
super(DeleteQueue, self).__init__(declarer, queue, fut=fut, span_parent=span_parent,
span_enqueued=span_enqueued)
......@@ -181,6 +184,7 @@ class Declarer(Channeler, Synchronized):
This also maintains a list of declared queues/exchanges, and redeclares them on each reconnect.
"""
__slots__ = ('in_process', 'on_discard', 'left_to_declare', 'declared', 'cluster')
def __init__(self, cluster):
"""
......
......@@ -13,14 +13,14 @@ def close_future(fut, span): # type: (Future, opentracing.Span) -> Future
"""
To be called as a Future callback, means to close the span
"""
if span is None:
return fut
try:
import opentracing
except ImportError:
return fut
if span is None:
return fut
def inner_close(fut): # type: (Future) -> None
exc = fut.exception()
if exc is not None:
......@@ -251,6 +251,7 @@ class Synchronized(object):
...
"""
__slots__ = ('_monitor_lock', )
def __init__(self):
self._monitor_lock = threading.Lock()
......
import unittest
from coolamqp.attaches import Declarer
class TestDeclarer(unittest.TestCase):
def test_declarer_slots(self):
"""Test that __slots__ are respected"""
d = Declarer(None)
def add_argument():
d.extra_argument = False
self.assertRaises(AttributeError, add_argument)
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