Skip to content

Conversation

vincent-pochet
Copy link
Collaborator

@vincent-pochet vincent-pochet commented May 30, 2025

Context

This PR follows #3747

Deleting a charge in a plan with a large number of override can cause Timeout error or lead to a memory error on Redis.

The main reasons are:

  • The service will enqueue one job per child charge
  • In the service, the soft deletion is done using discard_all witch is not scalable as it is using a DB call per record...

Description

This PR is refactoring the logic to enqueue only one job responsible of the soft deletion of all child charges.
The filter deletion is also done by replacing discard_all calls with update_all(deleted_at:)

Note: The same logic will have to be applied to both update and creation of child charges

@vincent-pochet vincent-pochet force-pushed the fix-large-charge-removal branch from 6293177 to 229453a Compare June 2, 2025 09:05
@vincent-pochet vincent-pochet merged commit 6d1880f into main Jun 2, 2025
14 checks passed
@vincent-pochet vincent-pochet deleted the fix-large-charge-removal branch June 2, 2025 09:09
vincent-pochet added a commit that referenced this pull request Jun 2, 2025
## Context

This PR follows #3747 and
#3765

Create a new charge in a plan with a large number of override can cause
Timeout error or lead to a memory error on Redis.

The main reasons is that the service will enqueue one job per child plan


## Description

This PR is refactoring the logic to enqueue only one job responsible of
the creation of all child charges.

Note: The same logic will have to be applied to the update of child
charges
diegocharles pushed a commit that referenced this pull request Jun 2, 2025
## Context

This PR follows #3747

Deleting a charge in a plan with a large number of override can cause
Timeout error or lead to a memory error on Redis.

The main reasons are:
- The service will enqueue one job per child charge
- In the service, the soft deletion is done using `discard_all` witch is
not scalable as it is using a DB call per record...


## Description

This PR is refactoring the logic to enqueue only one job responsible of
the soft deletion of all child charges.
The filter deletion is also done by replacing `discard_all` calls with
`update_all(deleted_at:)`

Note: The same logic will have to be applied to both update and creation
of child charges
diegocharles pushed a commit that referenced this pull request Jun 2, 2025
## Context

This PR follows #3747 and
#3765

Create a new charge in a plan with a large number of override can cause
Timeout error or lead to a memory error on Redis.

The main reasons is that the service will enqueue one job per child plan


## Description

This PR is refactoring the logic to enqueue only one job responsible of
the creation of all child charges.

Note: The same logic will have to be applied to the update of child
charges
lovrocolic added a commit that referenced this pull request Jun 9, 2025
## Context

This PR follows:
- #3747
- #3765
- #3767

Updating a charge in a plan with a large number of override can cause
Timeout error or lead to a memory error on Redis.

The main reason is:
- The service will enqueue one job per child charge


## Description

This PR is refactoring the logic to enqueue only one job responsible of
the updates for all child charges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants