Skip to content

refactor: convert ClientGatewayService to interface with async factory pattern#1116

Open
trim21 wants to merge 2 commits into
jesec:masterfrom
trim21:refactor/client-gateway-service-interface
Open

refactor: convert ClientGatewayService to interface with async factory pattern#1116
trim21 wants to merge 2 commits into
jesec:masterfrom
trim21:refactor/client-gateway-service-interface

Conversation

@trim21

@trim21 trim21 commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the ClientGatewayService abstract class with an interface and a shared BaseClientGatewayService abstract class
  • Each implementation receives dependencies (ClientRequestManager, AvailableMethodCalls) via constructor arguments, eliminating async field initializers
  • Each implementation provides a static async create(user) factory for construction
  • rTorrent's fetchAvailableMethodCalls is extracted to a standalone function taking ClientRequestManager as an argument — no more availableMethodCalls = this.fetchAvailableMethodCalls() pattern
  • testGateway() is now reserved solely for connectivity re-validation during retries, no longer serving as an async factory/initializer

trim21 and others added 2 commits May 9, 2026 15:54
…y pattern

Replace the abstract class with a ClientGatewayService interface plus
BaseClientGatewayService abstract class that holds shared retry/error logic.

Each implementation now:
- Takes dependencies (ClientRequestManager, AvailableMethodCalls) as
  constructor arguments, eliminating async field initializers
- Provides a static async create(user) factory for construction
- Has testGateway() reserved solely for connectivity re-validation
  during retries, no longer used for async init

rTorrent's fetchAvailableMethodCalls is extracted to a standalone
function taking ClientRequestManager as an argument.
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.

1 participant