From 8f3c3842835ab0baaf6d5ddf336c9cf19363c956 Mon Sep 17 00:00:00 2001 From: Lancetnik Date: Tue, 22 Aug 2023 00:06:29 +0300 Subject: [PATCH] fix: correct NatsJS rpc --- propan/brokers/nats/nats_js_broker.py | 4 ++-- tests/brokers/base/rpc.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/propan/brokers/nats/nats_js_broker.py b/propan/brokers/nats/nats_js_broker.py index 5b88e810..92f6f5a6 100644 --- a/propan/brokers/nats/nats_js_broker.py +++ b/propan/brokers/nats/nats_js_broker.py @@ -283,9 +283,9 @@ async def publish( token = client._nuid.next() token.extend(token_hex(2).encode()) - + reply_to = token.decode() future: asyncio.Future[Msg] = asyncio.Future() - sub = await client.subscribe(token.decode(), future=future, max_msgs=1) + sub = await client.subscribe(reply_to, future=future, max_msgs=1) await sub.unsubscribe(limit=1) if raise_timeout: diff --git a/tests/brokers/base/rpc.py b/tests/brokers/base/rpc.py index d5c1f385..41b2bc0c 100644 --- a/tests/brokers/base/rpc.py +++ b/tests/brokers/base/rpc.py @@ -18,7 +18,7 @@ async def m(): # pragma: no cover await full_broker.start() r = await full_broker.publish( - "hello", queue, callback_timeout=3, callback=True + "hello", queue, callback_timeout=3, callback=True, raise_timeout=True ) assert r == "1"