Skip to content
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

Merged
merged 1 commit into from
Mar 12, 2020
Merged

Conversation

Stebalien
Copy link
Member

Now that go-ipfs imports graphsync, we need to use the same peertaskqueue
implementation in bitswap as graphsync.

taskDataChan := make(chan *responseTaskData)
var taskData *responseTaskData
for {
nextTaskBlock := rm.queryQueue.PopBlock()
for nextTaskBlock == nil {
pid, tasks, _ := rm.queryQueue.PopTasks(targetWork)
Copy link
Member Author

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)
Copy link
Member Author

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})
Copy link
Member Author

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".

@Stebalien
Copy link
Member Author

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.

@Stebalien Stebalien merged commit 1632890 into master Mar 12, 2020
@Stebalien Stebalien deleted the feat/update-taskqueue branch March 12, 2020 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant