Skip to content

Handle Awaitility timeouts in StandardWebSocketClient #297

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

Merged
merged 3 commits into from
Aug 10, 2025

Conversation

tcheeric
Copy link
Owner

Summary

  • close WebSocket session and return empty list when Awaitility times out
  • add unit test covering timeout behaviour in StandardWebSocketClient
  • document timeout handling in CODEBASE_OVERVIEW

Testing

  • mvn -q verify (fails: Could not find a valid Docker environment for Testcontainers)

https://chatgpt.com/codex/tasks/task_b_68991b88190083319adad62249be2947

@tcheeric tcheeric requested a review from Copilot August 10, 2025 23:14
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error handling in the StandardWebSocketClient by implementing proper timeout behavior. When Awaitility times out waiting for a relay response, the client now gracefully closes the WebSocket session and returns an empty list instead of potentially leaving resources hanging.

  • Added timeout exception handling with session cleanup in StandardWebSocketClient
  • Created comprehensive unit test to verify timeout behavior
  • Updated documentation to clarify timeout handling expectations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
StandardWebSocketClient.java Added timeout exception handling, session cleanup, and package-private constructor for testing
StandardWebSocketClientTimeoutTest.java New unit test covering timeout scenario with mocked WebSocket session
pom.xml Added spring-boot-starter-test dependency for enhanced testing capabilities
CODEBASE_OVERVIEW.md Documented timeout behavior and client response expectations

@@ -1,7 +1,10 @@
package nostr.client.springwebsocket;

import lombok.NonNull;
import lombok.SneakyThrows;
Copy link
Preview

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SneakyThrows import is added but not used in the code. This unused import should be removed to keep the codebase clean.

Suggested change
import lombok.SneakyThrows;

Copilot uses AI. Check for mistakes.

…tandardWebSocketClient.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tcheeric tcheeric merged commit f459f5f into develop Aug 10, 2025
1 check passed
@tcheeric tcheeric deleted the codex/wrap-awaitility-in-try/catch-block branch August 10, 2025 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant