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

fix: reset operations after commit #721

Conversation

wouter-n
Copy link

Context:

I found this issue when batching many requests to a bulk writer and manually committing 10'000 operations at a time (see pseudo code below)

async with BulkWriter() as bulk_writer:
    for counter, item in enumerate(items):
        # Do operations with bulk_writer
         
        if counter % 10000 == 0:
            bulk_writer.commit()

What:

Reset the operations attribute after the operations have been committed in the bulk writer

Why:

To ensure that after committing the list of operations is not done twice after a manual call of commit()

Please let me know if I missed something or I'm using the bulk writer in the wrong way but this very much looks like a bug.

@roman-right
Copy link
Member

Interesting use-case. Thank you for the PR!
Could you please add a test? Using $inc operation for example

Copy link
Contributor

github-actions bot commented Dec 9, 2023

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Stale label Dec 9, 2023
Copy link
Contributor

This PR was closed because it has been stalled for 14 days with no activity.

@github-actions github-actions bot closed this Dec 24, 2023
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.

2 participants