-
Notifications
You must be signed in to change notification settings - Fork 28
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
Paginate Next Reward Payment #185
Conversation
gui/cache.go
Outdated
|
||
// Sort list so the largest percentages will be shown first. | ||
sort.Slice(quotas, func(i, j int) bool { | ||
larger := quotas[i].Percentage.Cmp(quotas[j].Percentage) > 0 |
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.
simpler to do return quotas[i].Percentage.Cmp(quotas[j].Percentage) > 0
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.
agreed
gui/cache.go
Outdated
@@ -48,8 +48,8 @@ type Cache struct { | |||
blockExplorerURL string | |||
minedWork []minedWork | |||
minedWorkMtx sync.RWMutex | |||
workQuotas []workQuota | |||
workQuotasMtx sync.RWMutex | |||
dividends []dividend |
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.
Hmm not sure about this change considering the values being reported here are not actual amounts being paid to participating accounts but percentages of the work contributed so far towards finding the next block. Maybe work quota
is also not descriptive or simple enough, but using dividend
here is misleading.
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.
Renamed to RewardQuota as discussed on Matrix
ba62ec0
to
7b2a84c
Compare
@@ -42,6 +41,12 @@ func (ui *GUI) renderIndex(w http.ResponseWriter, r *http.Request, modalError st | |||
} | |||
} | |||
|
|||
// Get the next reward payment percentages (max 10). | |||
rewardQuotas := ui.cache.getRewardQuotas() |
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.
Should we be concerned about how many results are returned here now that pagination has been implemented for reward quotas?
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 is for the initial render. When the page is first loaded we only want to display the top ten (ie. the first page).
When the pagination Javascript loads, clickable buttons are displayed which allow the user to load additional data on the next pages. If the Javascript does not load, only the first 10 results will be visible (hence #181).
If this is not limited, it is a potential DoS vector. We had a similar problem with VSP where information about 100s of tickets was passed into a template which caused the templating engine to take 10+ seconds to render.
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.
Gotcha, thanks.
Pagination for "Next Reward Payment" on the homepage.