diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 645f5faf..3f7ceb43 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Brewtils Changelog ================== +3.20.1 +------ +TBD + +- Fixed an issue where topics could repeat when using topic in @subscribe + 3.20.0 ------ 11/1/2023 diff --git a/brewtils/decorators.py b/brewtils/decorators.py index 9ccceb00..bc71bb8f 100644 --- a/brewtils/decorators.py +++ b/brewtils/decorators.py @@ -399,17 +399,23 @@ def returnTrue(self): topics: A list of topics to subscribe to """ - if topic: - topics.append(topic) + subscribe_topics = [] + if topic and topic not in subscribe_topics: + subscribe_topics.append(topic) + + if topics: + for list_topic in topics: + if list_topic not in subscribe_topics: + subscribe_topics.append(list_topic) if _wrapped is None: - return functools.partial(subscribe, topics=topics) + return functools.partial(subscribe, topics=subscribe_topics) # Python 2 compatibility if hasattr(_wrapped, "__func__"): - _wrapped.__func__.subscribe_topics = topics + _wrapped.__func__.subscribe_topics = subscribe_topics else: - _wrapped.subscribe_topics = topics + _wrapped.subscribe_topics = subscribe_topics return _wrapped