-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update the peer task queue #54
Conversation
taskDataChan := make(chan *responseTaskData) | ||
var taskData *responseTaskData | ||
for { | ||
nextTaskBlock := rm.queryQueue.PopBlock() | ||
for nextTaskBlock == nil { | ||
pid, tasks, _ := rm.queryQueue.PopTasks(targetWork) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Third return value is "remaining work" for this peer, which we really don't care about.
for _, task := range nextTaskBlock.Tasks { | ||
key := task.Identifier.(responseKey) | ||
for _, task := range tasks { | ||
key := task.Topic.(responseKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we put the peer ID in the Topic/Identifier?
@@ -292,7 +294,8 @@ func (prm *processRequestMessage) handle(rm *ResponseManager) { | |||
cancelFn: cancelFn, | |||
request: request, | |||
} | |||
rm.queryQueue.PushBlock(prm.p, peertask.Task{Identifier: key, Priority: int(request.Priority())}) | |||
// TODO: Use a better work estimation metric. | |||
rm.queryQueue.PushTasks(prm.p, peertask.Task{Topic: key, Priority: int(request.Priority()), Work: 1}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, I'm just assigning every item a work of "one".
We backed out of this for some reason but nobody can remember why. We're going to re-implement it and 🤞. If we have to back out of it again, we'll make sure to write down why. |
Now that go-ipfs imports graphsync, we need to use the same peertaskqueue
implementation in bitswap as graphsync.