Skip to content

create_account function getting slower and slower #275

@shucontech

Description

@shucontech

Describe the bug
I have around 20k users, for each user I create two accounts. As the number of users are increasing the functions are getting slower. Am I doing something wrong, is there a way to speed things up?

As the number of users are increasing the functions are getting slower. Am I doing something wrong, is there a way to speed things up?

To Reproduce
Steps to reproduce the behavior:

      entity.create_account(
            name=f"User {user.full_name} Receivable",
            code=f"{accounts.PATIENT_ACCOUNT}{user.id}",
            active=True,
            role=roles.ASSET_CA_RECEIVABLES,
            balance_type=roles.DEBIT,
            coa_model=coa_model,
        )

        entity.create_account(
            name=f"User {user.full_name} Collection",
            code=f"{accounts.RECEPTIONIST_ACCOUNT}{user.id}",
            active=True,
            role=roles.LIABILITY_CL_OTHER,
            balance_type=roles.CREDIT,
            coa_model=coa_model,
        )

Expected behavior
With 20k users these two functions take approx. 3 seconds

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

low impactLow impact issue.questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions