-
Notifications
You must be signed in to change notification settings - Fork 26
Refactor WebSocket handling and improve test robustness #498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Complete Changes from Version 0.2.2 to 0.5.1
Add Sonatype Central publishing credentials and refactor event handling
Update Maven configuration for central publishing
Update Maven settings and consolidate API improvements
…rs to StandardWebSocketClient Added a new public constructor to StandardWebSocketClient that accepts timeout parameters directly, eliminating the need for reflection-based configuration. New constructor: public StandardWebSocketClient(String relayUri, long awaitTimeoutMs, long pollIntervalMs) This allows callers to: - Configure timeouts programmatically without Spring @value annotations - Create StandardWebSocketClient outside of Spring DI context - Avoid reflection hacks for timeout configuration Version bumped from 1.0.1 to 1.1.0 (minor version) per semver as this adds new public API while maintaining backward compatibility. Benefits: - Cleaner API for programmatic configuration - No reflection required - Better testability - Aligns with constructor injection pattern 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added debug and error logging to StandardWebSocketClient to help diagnose timeout configuration issues: - Log actual timeout values when StandardWebSocketClient is created - Log timeout values being used when waiting for relay response - Include configured timeout values in error message when timeout occurs This helps verify that: 1. The constructor is being called with correct timeout values 2. The timeout values are being used in await() calls 3. The actual timeout duration matches the configured value 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add instructions for maintaining CHANGELOG.md following Keep a Changelog format with semantic versioning best practices. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The StandardWebSocketClient now configures the underlying WebSocketContainer with a default 1-hour max session idle timeout. This prevents premature connection closures when Nostr relays have periods of inactivity between messages (e.g., after EOSE when waiting for new events). Configuration: - nostr.websocket.max-idle-timeout-ms (default: 3600000, 1 hour) - Set to 0 for no timeout The fix uses ContainerProvider.getWebSocketContainer() to obtain the container, configures setDefaultMaxSessionIdleTimeout(), then passes the configured container to Spring's StandardWebSocketClient constructor. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Release 1.1.1 with fix for WebSocket idle timeout configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…obustness Replaced nostr-rs-relay with dockurr/strfry for integration tests, addressing timeout and crash issues. Enhanced WebSocket client retry logic, added configurable relay port, and included additional wait for indexing. Updated test setup for dynamic relay configuration and removed unused response comparison logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .withClasspathResourceMapping( | ||
| "strfry.conf", "/etc/strfry.conf", BindMode.READ_ONLY) | ||
| .withTmpFs(Map.of("/app/strfry-db", "rw")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide strfry.conf classpath mapping for relay container
The new Testcontainers relay setup maps strfry.conf into the container (withClasspathResourceMapping("strfry.conf", ...)), but the repository has no such resource under src/test/resources (e.g., find . -name strfry.conf returns nothing). When the container starts, Testcontainers fails to resolve the host path or the relay launches without its required config, so integration tests abort before running. Please add the config file or drop the mapping so the strfry container can start.
Useful? React with 👍 / 👎.
…strfry fixes Marked integration tests as resolved with all 24 passing using strfry relay. Documented issues with nostr-rs-relay and provided solutions, including custom strfry configuration, indexing delay, and relay-agnostic assertions. Enhanced troubleshooting section with detailed resolutions for common test issues.
Summary
This pull request refactors WebSocket handling to address connection timeout issues and enhance integration test robustness.
What changed?
nostr-rs-relaywithdockurr/strfryfor integration tests.nostr.websocket.max-idle-timeout-ms).AGENTS.md.BREAKING
None.
Review focus
Checklist