nats-io / nats.py

Python3 client for NATS

Home Page:https://nats-io.github.io/nats.py/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ping/pong is not working

ovnicraft opened this issue · comments

Observed behavior

After connection stablished, if connection goes stale ping/pong is not being executed.

after my debug i found:

_process_connect_init() is defining ping_interval_task and it process error for stale connections but task it self is never being called. (at least I could not find it.)

EXTRA: this issue could be related.

Expected behavior

stale connection being processed allowing developer catch it.
logs here

Server and client version

nats 2.10 (alpine image).

Host environment

macos m1

Steps to reproduce

  1. start nats server
  2. connect to server
  3. wait 10s
  4. stop server
  5. you can wait on client and is not ping/poing ing.

Thanks for raising the issue, the ping interval is working which you can confirm reducing the ping interval to be lower for example:

    nc = await nats.connect("nats://127.0.0.1:4222",
                            error_cb=_error_cb,
                            ping_interval=2,

I did confirm that the error callback is not reporting the type of disconnection so will fix that.