Added delay after upsert and delete for eventual consistency #480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The original code was correct, but the output at line 28 was misleading in the file - docs/quick-tour/interacting-with-the-index.ipynb.
Even after calling index.delete(ids=["A"]), the fetch result still included vector "A", which was unexpected. This occurred because vector deletions in the index are not immediately consistent — the deletion may take a few seconds to propagate before being reflected in fetch results.
Solution
To ensure consistency between delete and fetch operations, I added simple time.sleep() delays after the upsert() and delete() calls. This gives the system enough time to reflect the changes before verifying the result. The core logic remains unchanged, the added delays prevent false negatives in fetch outputs.
Type of Change
Test Plan