Damus

Recent Notes

cloud fodder · 4h
What is supposed to happen is the relay sends AUTH as the very first message. Some clients will ignore this and send a REQ or EVENT. In that case, it sends the proper close or true=false, and another AUTH. It continues to repeat this pattern until the AUTH response has been received. Then it wil...
Aeontropy · 3d
They suck the first time and that was enough for everyone to avoid it
jack (n/acc) · 3d
Lowkey real
reya profile picture
Hi @Yuki Kishimoto , I wonder if we could have an option to disable `wait_for_ok()` for the send event API. Sometimes I just want to send an event but collect the report later.

Use cases:
- A user sends a NIP-17 message. My app will update the UI immediately, then I will listen for OK notifications via `client.notifications` and update the UI accordingly.
1
Yuki Kishimoto · 4d
Done at https://github.com/rust-nostr/nostr/commit/07de813024f930803a1dd81942edb50eb8a87ba3
reya · 6d
Both. I'm just tested the sqlite backend, it still have same issue.
reya profile picture
Hi @Yuki Kishimoto ,
I think I've found the problem here. It looks like the SDK is waiting for the timeout to finish before returning the result, instead of returning immediately after receiving the event from the relay.

I've created a simple flow like this:
1. Spawn a task to listen for notifications via `client.notifications()`
2. In another task, send an event to the relay and get the output: `let event = client.send_event(event).await?`
3. You will see the notification in task <1> receive the OK event from the relay immediately.
4. However, in task <2>, the output only returns after 10 seconds (the default timeout).

Sorry for put the issue here. My GH account is locked, I will create another one later.
1
reya · 5d
Forgot attach screenshot. https://image.nostr.build/c3086fa1bf256af37adae1ae282bfaadfd360b70c26eb5ccb090666d8db72870.png
Yuki Kishimoto · 5d
Thanks, I'll check it, but I think that it's due to an unreachable relay that has just been added to the pool. The disconnected relays are skipped (return error instead of waiting) after the second failed attempt. To confirm it, can you try to decrease the connection timeout, configurable via the C...
reya · 5d
Hi nostr:npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet , I think I've found the problem here. It looks like the SDK is waiting for the timeout to finish before returning the result, instead of returning immediately after receiving the event from the relay. I've created a simple fl...
🇮🇹Davide btc âš¡ · 6d
your tweak fixed the issue, but might've masked underlying problems. what's your node's load and connection count?
reya · 6d
I've adjusted the `ok_timeout/timeout` to 1 or 2 seconds, and now everything seems fast, as if gossip is disabled. I think there are some bottlenecks when handle notification, cc nostr:npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet
Yuki Kishimoto · 1w
Yes, I've starter working on it a couple of days ago. The PR: https://github.com/rust-nostr/nostr/pull/1252 I'm working on making all the libraries runtime-agnostic. Hope to have a PR ready soon.
reya profile picture
It looks like nostr-sdk automatically runs negentropy sync when relays are added. I think this causes a bottleneck in my app and creates significant delays. My app flow works like this:

1. Users launch the app
2. The app connects to bootstrap relays
3. The app gets the user's relay list and verifies its existence
4. If the relay list exists → Get profile → Get and verify messaging relays

The flow is simple and runs step by step, so I don't think the backend affects it much. If I disable gossip, it runs fine.
1
reya · 6d
I've done some debugging. After I create subscriptions, the relay responds immediately, but somehow the notification channel isn't receiving events yet.
Yuki Kishimoto · 6d
Does this happen with the in-memory gossip store, or with the SQLite one? Or both?
Jeroen ✅ · 6d
This has been my annoyence with nostr devs. To insist on being a one-man foss team is to forgo building a great product
Niel Liesmons · 6d
Great benchmark, thanks!!
Yuki Kishimoto · 1w
Yes, I've starter working on it a couple of days ago. The PR: https://github.com/rust-nostr/nostr/pull/1252 I'm working on making all the libraries runtime-agnostic. Hope to have a PR ready soon.