Join Nostr
2025-11-14 23:09:27 UTC
in reply to

DanConwayDev on Nostr: when trying to diagnose the problem a few days ago I vibed this: <> what I found was ...

when trying to diagnose the problem a few days ago I vibed this:

<https://gitworkshop.dev/danconwaydev.com/ngit/tree/timeout-testing/timeout_test>;

what I found was that the connection was failing early (often &lt;500ms but always &lt;1s) whereas nak took a bit longer but succesfully estalished a connection.

sometimes try_connect would return Ok(()) but relay.is_connected() would return false.

When nak couldnt establish a connection try_connect seemed to honour the specified timeout instead of failing quickly.

I ended up building in auto-retry that retires after an ever increasing delay up until the timeout. See src/lib/client.rs line 773-842. What I found with this is it would fail quickly everytime but never, in my limited testing, did it successfully connect on subsiquent attempts.

I was wondering whether try_connect() was picking up some sort of unexpected service respose that nak was ignoring but rust-nostr saw as a failure. I stopped getting the failures before I could dig any deeper and I haven't had any since.

I did all of this on rust-nostr v0.43. The tip of master is now on v0.44 (but i hadn't pushed it when last built ngit from master so his failures would be using v0.43)