structs moved
This commit is contained in:
parent
150c5193e1
commit
9c79b04d4c
2 changed files with 10 additions and 6 deletions
|
|
@ -1,8 +1,11 @@
|
||||||
package taskAgent
|
package taskAgent
|
||||||
|
|
||||||
import "context"
|
import (
|
||||||
|
"context"
|
||||||
|
"task-processor/internal/structs"
|
||||||
|
)
|
||||||
|
|
||||||
type TaskAgent interface {
|
type TaskAgent interface {
|
||||||
FetchTasks(ctx context.Context) ([]Task, error)
|
FetchTasks(ctx context.Context) ([]structs.Task, error)
|
||||||
SendResults(ctx context.Context, results []Result) error
|
SendResults(ctx context.Context, results []structs.Result) error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"google.golang.org/protobuf/types/known/emptypb"
|
"google.golang.org/protobuf/types/known/emptypb"
|
||||||
"io"
|
"io"
|
||||||
|
"task-processor/internal/structs"
|
||||||
tt "task-processor/pkg/taskTransport/v1"
|
tt "task-processor/pkg/taskTransport/v1"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
@ -21,7 +22,7 @@ func newService(c tt.TaskProcessorClient, timeout time.Duration) *service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) FetchTasks(ctx context.Context) (received []Task, err error) {
|
func (s *service) FetchTasks(ctx context.Context) (received []structs.Task, err error) {
|
||||||
fetchCtx, cancel := context.WithTimeout(ctx, s.timeout)
|
fetchCtx, cancel := context.WithTimeout(ctx, s.timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
|
@ -42,7 +43,7 @@ func (s *service) FetchTasks(ctx context.Context) (received []Task, err error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
received = append(received, Task{
|
received = append(received, structs.Task{
|
||||||
MerchUuid: task.MerchUuid,
|
MerchUuid: task.MerchUuid,
|
||||||
Origins: task.Origins,
|
Origins: task.Origins,
|
||||||
})
|
})
|
||||||
|
|
@ -52,7 +53,7 @@ func (s *service) FetchTasks(ctx context.Context) (received []Task, err error) {
|
||||||
return received, nil
|
return received, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) SendResults(ctx context.Context, results []Result) error {
|
func (s *service) SendResults(ctx context.Context, results []structs.Result) error {
|
||||||
sendCtx, cancel := context.WithTimeout(ctx, s.timeout)
|
sendCtx, cancel := context.WithTimeout(ctx, s.timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue