Track scheduled driver index build tasks#1519
Conversation
|
@RitwijParmar falkordb_driver.py changed on main so this no longer applies. Could you rebase? Also worth syncing with #1636 which touches the same lifecycle. |
Signed-off-by: Ritwij Aryan Parmar <ritwij.aryan.parmar@gmail.com>
a830335 to
5ec6d7f
Compare
|
I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail: example@example.com or I have read the CLA Document and I hereby sign the CLA behalf of my company, e-mail: example@example.com Signature is valid for 6 months. This bot will be retriggered when the Contributor License Agreement comment has been provided. Posted by the CLA Assistant Lite bot. |
|
Rebased onto current main and pushed. The driver index task ownership and close-time cancellation are unchanged after the rebase. I checked #1636 as well. It covers the same driver lifecycle area but a separate init-task issue, so this PR stays focused on retaining and cancelling the scheduled index-build task. Focused tests pass 27 with 1 skipped and Ruff is clean. |
|
I have read and agree to the Zep CLA on behalf of myself, e-mail: ritwij.aryan.parmar@gmail.com |
|
I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail: ritwij.aryan.parmar@gmail.com |
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
Neo4jDriverandFalkorDriverclose(), retrieve completed task exceptions or cancel and await pending tasksTests
/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.pyResult: 25 passed, 1 skipped.
I have read and agree to the Zep CLA.