interface rename + method change
This commit is contained in:
parent
c1c0e46184
commit
d19f5f7621
2 changed files with 8 additions and 6 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue