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

Refactor scoring service #7841

Merged
merged 5 commits into from
Nov 17, 2020
Merged

Refactor scoring service #7841

merged 5 commits into from
Nov 17, 2020

Conversation

farazdagi
Copy link
Contributor

@farazdagi farazdagi commented Nov 17, 2020

What type of PR is this?

Other / Refactoring

What does this PR do? Why is it needed?

  • Extracted from Peer status peer scorer #7480, adds the following changes:
    • Removes weight from bad responses scorer (score is penalty, so no weight is necessary)
    • Removes contexts from scorers. We have this anti-pattern everywhere, when we are passing ctx to control life-time of the service: fortunately, ctx in scorers are not used at all, so easy to refactor/remove.
    • Adds Scorer interface, makes sure that both scorers and scorer service comply to it. This means that we can use individual scorers, and when necessary can query service object, which will traverse all registered scorers. For ex, IsBadPeer(pid) when called on service object will traverse all the individual scorers and mark peer as bad if any of the scorers mark it as such.
    • Adds weights to individual scorers, allowing us to control how much each individual scorer contributes to the overall score (also allows having scorers with 0 weight - such scorers are useful individually, but not contributing to overall score).

Which issues(s) does this PR fix?

N/A

Other notes for review

@farazdagi farazdagi self-assigned this Nov 17, 2020
@farazdagi farazdagi changed the title refactor scoring service Refactor scoring service Nov 17, 2020
@farazdagi farazdagi marked this pull request as ready for review November 17, 2020 12:54
@farazdagi farazdagi requested a review from a team as a code owner November 17, 2020 12:54
@farazdagi farazdagi added OK to merge Ready For Review A pull request ready for code review labels Nov 17, 2020
@nisdas nisdas merged commit 2034c66 into master Nov 17, 2020
@delete-merged-branch delete-merged-branch bot deleted the refactor-scoring-service branch November 17, 2020 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants