This repository was archived by the owner on Oct 17, 2020. It is now read-only.
Rename Worker in master package to WorkerClient#10
Open
eugeneYWang wants to merge 2 commits intomasterfrom
Open
Rename Worker in master package to WorkerClient#10eugeneYWang wants to merge 2 commits intomasterfrom
eugeneYWang wants to merge 2 commits intomasterfrom
Conversation
Collaborator
Author
|
BTW, the edit on go.sum and go.mod is automatically improved by GoLand. so I think those changes should be okay. Let me know if they should not be there. |
naturetime10
suggested changes
Aug 31, 2020
master/master.go
Outdated
| // process the current site there is idle worker | ||
| worker := <-m.idleWorkers | ||
| // process the current site there is idle workerClients | ||
| worker := <-m.idleWorkerClients |
Member
There was a problem hiding this comment.
Suggested change
| worker := <-m.idleWorkerClients | |
| workerClient := <-m.idleWorkers |
master/server.go
Outdated
| workerID := s.master.RegisterWorker(worker) | ||
| fmt.Printf("Worker registed: ID(%d) IP(%s) PORT(%d) SECRET(%s)\n", workerID, request.Ip, int(request.Port), request.Secret) | ||
| workerID := s.master.RegisterWorker(workerClient) | ||
| fmt.Printf("WorkerClient registed: ID(%d) IP(%s) PORT(%d) SECRET(%s)\n", workerID, request.Ip, int(request.Port), request.Secret) |
Member
There was a problem hiding this comment.
Suggested change
| fmt.Printf("WorkerClient registed: ID(%d) IP(%s) PORT(%d) SECRET(%s)\n", workerID, request.Ip, int(request.Port), request.Secret) | |
| fmt.Printf("Worker registered: ID(%d) IP(%s) PORT(%d) SECRET(%s)\n", workerID, request.Ip, int(request.Port), request.Secret) |
master/master.go
Outdated
Comment on lines
+10
to
+11
| workerClients []WorkerClient | ||
| idleWorkerClients chan WorkerClient |
Member
There was a problem hiding this comment.
Suggested change
| workerClients []WorkerClient | |
| idleWorkerClients chan WorkerClient | |
| workers []WorkerClient | |
| idleWorkers chan WorkerClient |
Thank you making the changes. I feel calling them workers is more natural in this code. You may disagree though.
master/master.go
Outdated
| go func(link string) { | ||
| // process the current site there is idle worker | ||
| worker := <-m.idleWorkers | ||
| // process the current site there is idle workerClients |
Member
There was a problem hiding this comment.
Suggested change
| // process the current site there is idle workerClients | |
| // process the current site there is idle worker |
master/master.go
Outdated
| err := worker.FetchLinks(ctx, link) | ||
| if err != nil { | ||
| m.idleWorkers <- worker | ||
| m.idleWorkerClients <- worker |
Member
There was a problem hiding this comment.
Suggested change
| m.idleWorkerClients <- worker | |
| m.idleWorkers <- worker |
master/master.go
Outdated
| m.linksCh <- links | ||
| go func() { | ||
| m.idleWorkers <- m.workers[workerID] | ||
| m.idleWorkerClients <- m.workerClients[workerID] |
Member
There was a problem hiding this comment.
Suggested change
| m.idleWorkerClients <- m.workerClients[workerID] | |
| m.idleWorkers <- m.workers[workerID] |
master/master.go
Outdated
| func (m *Master) RegisterWorker(worker Worker) int { | ||
| workID := len(m.workers) | ||
| m.workers = append(m.workers, worker) | ||
| func (m *Master) RegisterWorker(workerClient WorkerClient) int { |
Member
There was a problem hiding this comment.
Suggested change
| func (m *Master) RegisterWorker(workerClient WorkerClient) int { | |
| func (m *Master) RegisterWorker(worker WorkerClient) int { |
Member
|
@eugeneYWang Sounds good! |
Collaborator
Author
|
suggested changes were applied. Does it look good? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This time it should be right.