Skip to content

sdk: rework relay connection task handling - #1491

Merged
yukibtc merged 2 commits into
masterfrom
sdk-rework-relay-task
Oct 13, 2026
Merged

yukibtc merged 2 commits into
masterfrom
sdk-rework-relay-task

Conversation

@yukibtc

@yukibtc yukibtc commented Oct 7, 2026

Copy link
Copy Markdown
Member

Description

Rework the relay connection task handling, and fix the issues raised at #1479

Replaces #1479

Notes to the reviewers

This is a bit larger PR compared to #1479, but includes a complete refactor of the connection task handling, which now should be clearer and more robust.

Checklist

  • I followed the contribution guidelines
  • I updated the relevant CHANGELOG.md (if applicable)
  • I understand and can explain all code in this PR

@yukibtc
yukibtc requested a review from TheAwiteb as a code owner October 7, 2026 09:47
yukibtc added a commit that referenced this pull request Oct 7, 2026
Keep one task per relay and retain connection requests while an old WebSocket closes. Share connection outcomes between `Relay::try_connect` callers and stop the task on ban, shutdown or the last Relay drop.

Replaces #1479

Pull-Request: #1491
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc pushed a commit that referenced this pull request Oct 7, 2026
Record the connection count for each long-lived subscription so a new session restores it even when it starts in the same second.

Ref #1479

Pull-Request: #1491
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
@yukibtc
yukibtc force-pushed the sdk-rework-relay-task branch from 3c5e0c9 to b5afc69 Compare October 7, 2026 09:50
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.38188% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
nostr-sdk/src/relay/inner.rs 97.99% 16 Missing ⚠️
nostr-sdk/src/test_utils.rs 98.39% 3 Missing ⚠️
nostr-sdk/src/relay/api/send_event.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@yukibtc
yukibtc force-pushed the sdk-rework-relay-task branch from b5afc69 to 31a0237 Compare October 12, 2026 10:56
yukibtc added a commit that referenced this pull request Oct 12, 2026
Keep one task per relay and retain connection requests while an old WebSocket closes. Share connection outcomes between `Relay::try_connect` callers and stop the task on ban, shutdown or the last Relay drop.

Replaces #1479

Pull-Request: #1491
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc pushed a commit that referenced this pull request Oct 12, 2026
Record the connection count for each long-lived subscription so a new session restores it even when it starts in the same second.

Ref #1479

Pull-Request: #1491
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc and others added 2 commits October 13, 2026 13:26
Keep one task per relay and retain connection requests while an old WebSocket closes. Share connection outcomes between `Relay::try_connect` callers and stop the task on ban, shutdown or the last Relay drop.

Replaces #1479

Pull-Request: #1491
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
Record the connection count for each long-lived subscription so a new session restores it even when it starts in the same second.

Ref #1479

Pull-Request: #1491
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
@yukibtc
yukibtc force-pushed the sdk-rework-relay-task branch from 31a0237 to c28142e Compare October 13, 2026 13:27
@yukibtc
yukibtc merged commit c28142e into master Oct 13, 2026
42 checks passed
@yukibtc
yukibtc deleted the sdk-rework-relay-task branch October 13, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants