Skip to content

refactor: centralize websocket retry settings #256

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 1 commit into from
Aug 3, 2025

Conversation

tcheeric
Copy link
Owner

@tcheeric tcheeric commented Aug 3, 2025

Summary

  • add reusable @NostrRetryable annotation encapsulating retry configuration
  • apply the annotation to SpringWebSocketClient send methods to remove duplicate settings

Testing

  • mvn -q verify (fails: Previous attempts to find a Docker environment failed. Will not retry.)

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

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

Centralizes WebSocket retry configuration by creating a reusable @NostrRetryable annotation to eliminate code duplication and improve maintainability.

  • Created a new meta-annotation that encapsulates retry configuration for WebSocket operations
  • Replaced duplicate @Retryable annotations in SpringWebSocketClient with the centralized annotation
  • Extracted retry settings as constants for better configurability

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
NostrRetryable.java New meta-annotation that encapsulates common retry configuration with constants
SpringWebSocketClient.java Simplified by replacing duplicate retry annotations with the new centralized annotation

Comment on lines +17 to +18
@Retryable(value = IOException.class, maxAttempts = NostrRetryable.MAX_ATTEMPTS,
backoff = @Backoff(delay = NostrRetryable.DELAY, multiplier = NostrRetryable.MULTIPLIER))
Copy link
Preview

Copilot AI Aug 3, 2025

Choose a reason for hiding this comment

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

Using the annotation's own constants in its definition creates a circular dependency that may not work as expected. Consider using literal values directly in the @retryable annotation instead.

Suggested change
@Retryable(value = IOException.class, maxAttempts = NostrRetryable.MAX_ATTEMPTS,
backoff = @Backoff(delay = NostrRetryable.DELAY, multiplier = NostrRetryable.MULTIPLIER))
@Retryable(value = IOException.class, maxAttempts = 3,
backoff = @Backoff(delay = 500L, multiplier = 2.0))

Copilot uses AI. Check for mistakes.

@tcheeric tcheeric merged commit 7927700 into develop Aug 3, 2025
@tcheeric tcheeric deleted the codex/extract-retry-configuration-as-constants branch August 3, 2025 13:46
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