fix: queue outgoing events when relay connection is down #2

Open
padreug wants to merge 1 commit from fix/queue-outgoing-events into main
Owner

Summary

  • Adds a bounded pending event queue (max 100) at the RelayManager level so outgoing EVENT messages are preserved when all relay connections are down
  • Drains EVENT messages from dead relay queues before relay restart to prevent in-flight event loss
  • Flushes pending events to all connected relays on reconnection via an on_connect callback

Closes aiolabs/nostrclient#1

Test plan

  • Publish an event while all relays are disconnected, verify it appears in logs as queued
  • Reconnect a relay and verify queued events are flushed (check logs for "Flushed N pending event(s)")
  • Publish >100 events while disconnected, verify oldest are dropped and newest retained
  • Verify normal event publishing (relays connected) is unaffected
  • Verify REQ/CLOSE messages are not queued in pending events during relay drain

🤖 Generated with Claude Code

## Summary - Adds a bounded pending event queue (max 100) at the `RelayManager` level so outgoing EVENT messages are preserved when all relay connections are down - Drains EVENT messages from dead relay queues before relay restart to prevent in-flight event loss - Flushes pending events to all connected relays on reconnection via an `on_connect` callback Closes aiolabs/nostrclient#1 ## Test plan - [ ] Publish an event while all relays are disconnected, verify it appears in logs as queued - [ ] Reconnect a relay and verify queued events are flushed (check logs for "Flushed N pending event(s)") - [ ] Publish >100 events while disconnected, verify oldest are dropped and newest retained - [ ] Verify normal event publishing (relays connected) is unaffected - [ ] Verify REQ/CLOSE messages are not queued in pending events during relay drain 🤖 Generated with [Claude Code](https://claude.ai/code)
fix: queue outgoing events when relay connection is down
Some checks failed
ci.yml / fix: queue outgoing events when relay connection is down (pull_request) Failing after 0s
115e869225
When all relay connections are temporarily lost, EVENT messages published
by extensions (nostrmarket, events) are now queued in a bounded deque
(max 100) instead of being silently dropped. On reconnection, queued
events are flushed to all connected relays. Dead relay queues are also
drained before restart to preserve in-flight events.

Closes aiolabs/nostrclient#1

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Some checks failed
ci.yml / fix: queue outgoing events when relay connection is down (pull_request) Failing after 0s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/queue-outgoing-events:fix/queue-outgoing-events
git switch fix/queue-outgoing-events

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff fix/queue-outgoing-events
git switch fix/queue-outgoing-events
git rebase main
git switch main
git merge --ff-only fix/queue-outgoing-events
git switch fix/queue-outgoing-events
git rebase main
git switch main
git merge --no-ff fix/queue-outgoing-events
git switch main
git merge --squash fix/queue-outgoing-events
git switch main
git merge --ff-only fix/queue-outgoing-events
git switch main
git merge fix/queue-outgoing-events
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/nostrclient!2
No description provided.