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

2023 slow statements fix #195

Merged
merged 7 commits into from
Dec 7, 2023
Merged

2023 slow statements fix #195

merged 7 commits into from
Dec 7, 2023

Conversation

fearoffish
Copy link
Contributor

What

Some organisations have many many tasks in their events list, which are typically one off quick scripts. The sheer amount of them causes a memory issue for node to handle on a statements page. This fix gathers all tasks and groups them into one aggregate event with a summed cost for all of them in one.

How to review

Deploy to a dev environment and then check the statements page. This really needs a huge number of task events (say 50k a day) to really see the benefit.

Who can review

Anyone who can deploy the app.


🚨⚠️ Please do not merge this pull request via the GitHub UI ⚠️🚨

Copy link
Contributor

@corlettb corlettb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small things. We will need to create a ticket to come back to this PR.

// Check if the resource type is "task"
row, err := rows.Event()

if row != nil && row.ResourceType != "" && row.ResourceType == "task" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the row.ResourceType != "" is redundant if we are checking the row.ResourceType == "task"

key := fmt.Sprintf("%s-%s", row.OrgGUID, row.SpaceGUID)

// Convert the price values to float
priceInc, _ := strconv.ParseFloat(row.Price.IncVAT, 128)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParseFloat should only get 32 or 64... We should switch back to 64 as it only returns a float64.

@fearoffish fearoffish merged commit 3c83877 into main Dec 7, 2023
2 checks passed
@fearoffish fearoffish deleted the 2023-statements-fix branch December 7, 2023 09:13
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.

None yet

2 participants