Skip to content

Conversation

@bodintsov
Copy link
Contributor

Ticket

Purpose

Optimize subscription population scripts

Changes

Optimize subscription population scripts

Side Effects

TBD

QE Notes

TBD

CE Notes

TBD

Documentation

TBD

)
total_created += len(items_to_create)

print(f"Created {total_created} subscriptions.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add a timing to track how long it takes, for each batch and/or for the total.

@cslzchen cslzchen marked this pull request as draft January 20, 2026 14:51
total_created = 0

for count, user in enumerate(user_qs, 1):
batch_start = datetime.now()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move batch_start out of the for loop and reset it after each batch process.

print(f'Error during bulk_create: {e}')
finally:
items_to_create.clear()
batch_end = datetime.now()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similarly, batch_end should be inside the if block for processing each batch.

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