load balancer implementation, code refactoring
This commit is contained in:
15
server/internal/worker.go
Normal file
15
server/internal/worker.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package internal
|
||||
|
||||
type Worker struct {
|
||||
requests chan Process // downloads to do
|
||||
pending int // downloads pending
|
||||
index int // index in the heap
|
||||
}
|
||||
|
||||
func (w *Worker) Work(done chan *Worker) {
|
||||
for {
|
||||
req := <-w.requests
|
||||
req.Start()
|
||||
done <- w
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user