Share single torrent client across all services, eliminate triple qBittorrent login on startup
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
|
||||
pb "homelab.lan/music-agregator/gen/music_agregator/torrent/v1"
|
||||
"homelab.lan/music-agregator/internal/config"
|
||||
)
|
||||
|
||||
type TorrentServer struct {
|
||||
@@ -15,14 +14,8 @@ type TorrentServer struct {
|
||||
pb.UnimplementedTorrentServiceServer
|
||||
}
|
||||
|
||||
func NewTorrentServer(cfg config.Config) (*TorrentServer, error) {
|
||||
service, err := NewTorrentService(cfg)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("failed to initialize TorrentService")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TorrentServer{service: service}, nil
|
||||
func NewTorrentServer(client TorrentClient) *TorrentServer {
|
||||
return &TorrentServer{service: NewTorrentService(client)}
|
||||
}
|
||||
|
||||
func (server *TorrentServer) List(ctx context.Context, req *pb.ListRequest) (*pb.ListResponse, error) {
|
||||
|
||||
Reference in New Issue
Block a user