From d19f5f7621303a448af14e9ae6c0b754d2ca5af9 Mon Sep 17 00:00:00 2001 From: nquidox Date: Fri, 3 Apr 2026 20:53:54 +0300 Subject: [PATCH] interface rename + method change --- internal/tasks/handler.go | 8 +++++--- internal/tasks/interface.go | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/tasks/handler.go b/internal/tasks/handler.go index 35ba365..d888027 100644 --- a/internal/tasks/handler.go +++ b/internal/tasks/handler.go @@ -4,8 +4,8 @@ import ( "context" "encoding/json" log "github.com/sirupsen/logrus" - "parser-mandarake/internal/common" rabbit "repo.nqws.ru/merch-tracker-v2/mt-rabbit" + "scrapper-mandarake/internal/common" ) const pkgLogHeader string = "Tasks client |" @@ -28,7 +28,7 @@ type Deps struct { ChanLen uint } -func New(deps Deps) *Handler { +func New(deps Deps) TaskTransport { var h Handler h.chanLen = deps.ChanLen @@ -107,8 +107,9 @@ func (h *Handler) GetTasks(ctx context.Context) <-chan common.Task { return getTasks } -func (h *Handler) SendResult(ctx context.Context, resultChan chan common.Result) { +func (h *Handler) SendResult(ctx context.Context) chan common.Result { pub := h.publisher.Start(ctx, h.chanLen) + resultChan := make(chan common.Result, h.chanLen) go func() { defer close(resultChan) @@ -129,4 +130,5 @@ func (h *Handler) SendResult(ctx context.Context, resultChan chan common.Result) } } }() + return resultChan } diff --git a/internal/tasks/interface.go b/internal/tasks/interface.go index 2e0c116..b755cd7 100644 --- a/internal/tasks/interface.go +++ b/internal/tasks/interface.go @@ -2,10 +2,10 @@ package tasks import ( "context" - "parser-mandarake/internal/common" + "scrapper-mandarake/internal/common" ) -type Tasker interface { +type TaskTransport interface { GetTasks(ctx context.Context) <-chan common.Task - SendResult(ctx context.Context, resultChan chan common.Result) + SendResult(ctx context.Context) chan common.Result }