Skip to content

Track scheduled driver index build tasks#1519

Open
RitwijParmar wants to merge 1 commit into
getzep:mainfrom
RitwijParmar:codex/driver-index-task-cleanup
Open

Track scheduled driver index build tasks#1519
RitwijParmar wants to merge 1 commit into
getzep:mainfrom
RitwijParmar:codex/driver-index-task-cleanup

Conversation

@RitwijParmar

Copy link
Copy Markdown

Summary

Fixes #1513 by keeping references to the constructor-scheduled index build tasks in the Neo4j and FalkorDB drivers, then cancelling/awaiting them during driver close before closing the underlying database client.

This prevents the fire-and-forget build_indices_and_constraints() task from being abandoned when a function-scoped event loop or short-lived application shuts down.

Changes

  • Store the scheduled index build task on Neo4jDriver and FalkorDriver
  • On close(), retrieve completed task exceptions or cancel and await pending tasks
  • Add regression coverage for pending index task cleanup in both drivers

Tests

  • /tmp/graphiti/.venv/bin/python -m ruff check graphiti_core/driver/neo4j_driver.py graphiti_core/driver/falkordb_driver.py tests/driver/test_neo4j_driver.py tests/driver/test_falkordb_driver.py
  • /tmp/graphiti/.venv/bin/python -m pytest tests/driver/test_neo4j_driver.py tests/driver/test_falkordb_driver.py

Result: 25 passed, 1 skipped.

I have read and agree to the Zep CLA.

Signed-off-by: Ritwij Aryan Parmar <[email protected]>
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.

Neo4jDriver.__init__:57 schedules orphan create_task without cancel/await pair

1 participant