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: Parrallelize charge usage computation #2076

Merged
merged 1 commit into from
May 28, 2024
Merged

Conversation

vincent-pochet
Copy link
Collaborator

Context

This PR is part of the epic to improve performance of current usage and billing process.

Description

It:

  • Preloads taxes, billable_metric, organization, filters and the related values
  • Updates ChargeFilters::MatchingAndIgnoredService, to make sure it uses the preloaded charge rather than querying it for each charge
  • Uses Parallel to compute the charge usage on multiple parrallel threads

@vincent-pochet vincent-pochet changed the title feat: Parralelize charge usage computation feat: Parrallelize charge usage computation May 28, 2024
@vincent-pochet vincent-pochet merged commit f957323 into main May 28, 2024
6 checks passed
@vincent-pochet vincent-pochet deleted the feat-parallel-usage branch May 28, 2024 14:18
vincent-pochet added a commit that referenced this pull request May 28, 2024
)

## Context

This PR follows #2076

## Description

It tries to fix an issue with the connection pool:
```
could not obtain a connection from the pool within 5.000 seconds (waited 5.000 seconds); all pooled connections were in use (ActiveRecord::ConnectionTimeoutError)
```
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.

2 participants