-
Notifications
You must be signed in to change notification settings - Fork 235
Closed
Labels
defectSuspected defect such as a bug or regressionSuspected defect such as a bug or regression
Description
Observed behavior
Hi,
I may be doing something wrong but I couldn't find a good way to do this. If I try to reuse a JS context, it fails to send any messages and times out on every send
JS = None
async def _async_publish_to_nats(
topic: str,
payload: Optional[bytes] = None,
headers: Optional[dict[str, str]] = None):
global JS
if JS is None:
nc = await nats.connect(settings.NATS_URL)
JS = nc.jetstream()
await JS.publish(**kwargs)
Apologies if I am trying to solve this the wrong way, I have been through all the docs, asked on the slack and gone over most of the source code.
Expected behavior
The context should be capable of sending messages later. Ideally, without reconnecting as the connect takes around 30ms.
Server and client version
nats-py v2.10.0
nats-server v2.11.8
Host environment
No response
Steps to reproduce
No response
Metadata
Metadata
Assignees
Labels
defectSuspected defect such as a bug or regressionSuspected defect such as a bug or regression