crossbario / crossbario/autobahn-python

Subscribing with get_retained=True calls previous subscriber

Open
#1,226 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.5k
Forks
768
PR merge metrics
No merged PRs in 30d

Description

Hi,

It appears that subscribing to a topic with options=SubscribeOptions(get_retained=True) causes previous subscribers to get called again. For example, suppose that someone has already posted 'bar' to a topic 'foo', and we run this:

def f1(msg):
    print(f"f1({msg})")
def f2(msg):
    print(f"f2({msg})")
def f3(msg):
    print(f"f3({msg})")

await session.subscribe(f1, 'foo', options=SubscribeOptions(get_retained=True))
await session.subscribe(f2, 'foo', options=SubscribeOptions(get_retained=True))
await session.subscribe(f3, 'foo', options=SubscribeOptions(get_retained=True))

What will get printed is:

f1(bar)
f1(bar)
f2(bar)
f1(bar)
f2(bar)
f3(bar)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the three-subscription example from the issue and trace the subscription and retained-message handling. Done means subscribing with get_retained=True delivers the retained message to the new callback without invoking previous subscribers again.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.