broker icon indicating copy to clipboard operation
broker copied to clipboard

Status subscriber timeout doesn't work in Python

Open mavam opened this issue 7 years ago • 3 comments

Consider this example:

#!/usr/bin/env python

import broker

endpoint = broker.Endpoint()
status_subscriber = endpoint.make_status_subscriber(True)
msg = status_subscriber.get(0.5)

The output:

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    msg = status_subscriber.get(0.5)
  File ".../env/lib/python/broker/__init__.py", line 128, in get
    x = self._subscriber.get(*args, **kwargs)
TypeError: Unable to convert function return value to a Python type! The signature was
        (self: broker._broker.StatusSubscriberBase, arg0: float) -> caf::optional<caf::variant<broker::none, caf::error, broker::status> >

It looks like we need to dispatch the variant to different Python types.

mavam avatar Sep 28 '18 13:09 mavam

Thanks, would you be able to create a PR that fixes it?

Note that you should currently be able to get equivalent behavior to what you want via:

msg = status_subscriber.get(1, 0.5)

jsiwek avatar Sep 28 '18 14:09 jsiwek

Thanks, would you be able to create a PR that fixes it?

Yeah, but unfortunately I'm quite pressed on cycles before BroCon. I put it on my todo list for afterwards.

mavam avatar Sep 28 '18 14:09 mavam

@mavam I believe the status subscriber has actually been re-implemented since then. Does this still happen?

Neverlord avatar Apr 16 '22 07:04 Neverlord