Skip to content

Commit

Permalink
fixed for review
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsova authored and Serov committed Sep 22, 2023
1 parent 8221be8 commit 045d168
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
3 changes: 1 addition & 2 deletions read_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"github.com/streadway/amqp"
"piper/wpqueue"
"sync"
)

Expand Down Expand Up @@ -130,7 +129,7 @@ func (rq *ReadQueue) Run() error {
return fmt.Errorf("[Rq][%s][Run]: %s", rq.queue, err)
}
wg.Add(1)
pool := wpqueue.NewWorkerPool(rq.routines, rq.queue, deliveries)
pool := NewWorkerPool(rq.routines, rq.queue, deliveries)
go pool.RunWorkerPool()

go func() {
Expand Down
14 changes: 14 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package piper

import "github.com/streadway/amqp"

type Message struct {
UID string `json:"uid"`
Payload any `json:"payload"`
Expand All @@ -25,3 +27,15 @@ type Report struct {
Reject *RejectReport `json:"reject,omitempty"`
Fail *FailReport `json:"fail,omitempty"`
}

type QueueWorkerPool struct {
workersCount int
queue string
deliveries <-chan amqp.Delivery
results chan ResultDelivery
}

type ResultDelivery struct {
WorkerId int
Delivery amqp.Delivery
}
2 changes: 1 addition & 1 deletion wpqueue/wp.go → wp_queue.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wpqueue
package piper

import (
"fmt"
Expand Down
15 changes: 0 additions & 15 deletions wpqueue/type.go

This file was deleted.

0 comments on commit 045d168

Please sign in to comment.