Skip to content

Commit

Permalink
Fixed subscribe topic bug (#417)
Browse files Browse the repository at this point in the history
Fixed subscribe topic bug
  • Loading branch information
TheBurchLog authored Nov 2, 2023
1 parent ba17461 commit 0e28b10
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 11 additions & 5 deletions brewtils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0e28b10

Please sign in to comment.