-
Notifications
You must be signed in to change notification settings - Fork 10
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
Have a configurable maximum active work per peer #10
Conversation
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.
This looks correct.
@@ -172,6 +175,16 @@ func (p *PeerTracker) PopTasks(targetMinWork int) ([]*peertask.Task, int) { | |||
var out []*peertask.Task | |||
work := 0 | |||
for p.taskQueue.Len() > 0 && p.freezeVal == 0 && work < targetMinWork { | |||
if p.maxActiveWorkPerPeer > 0 { | |||
// Do not add work to a peer that is already maxed out | |||
p.activelk.Lock() |
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.
NOTE: I think we need to revisit this lock.
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.
But not now.
Please rebase this PR on top of master, so that the new GitHub Actions workflows (merged in #13) are run. |
2b501cb
to
24f8245
Compare
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.
LGTM
No description provided.