Skip to content

fix(firestore): BulkWriter pop from an empty deque#17490

Open
daniel-sanche wants to merge 2 commits into
mainfrom
firestore_index_error
Open

fix(firestore): BulkWriter pop from an empty deque#17490
daniel-sanche wants to merge 2 commits into
mainfrom
firestore_index_error

Conversation

@daniel-sanche

Copy link
Copy Markdown
Contributor

In some situations, the BulkWriter would attempt to pop a retry config from an empty deque. This PR adds a safeguard to end immediately if the list is empty

Fixes #16138

@daniel-sanche daniel-sanche requested a review from a team as a code owner June 16, 2026 23:50

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a safety check to _schedule_ready_retries in bulk_writer.py to prevent popping from an empty _retries queue. The reviewer suggested a performance improvement to break out of the loop early when the queue is empty, rather than checking the condition on every iteration.

Comment thread packages/google-cloud-firestore/google/cloud/firestore_v1/bulk_writer.py Outdated
…_writer.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

BulkWriter produces IndexError: pop from an empty deque

1 participant