Add specific driver closing to avoid issues with neo4

This commit is contained in:
Vasilije 2024-01-09 17:22:02 +01:00
parent 0120421195
commit 8aeef5ca4f
2 changed files with 3 additions and 3 deletions

2
api.py
View file

@ -306,7 +306,7 @@ async def unlink_user_from_public_memory(payload: Payload):
async with session_scope(session=AsyncSessionLocal()) as session:
from main import unlink_user_from_memory
# Assuming you have a method in Neo4jGraphDB to execute the query
result = await unlink_user_from_memory( user_id = decoded_payload['user_id'], topic=topic)
result = await unlink_user_from_memory( user_id = decoded_payload['user_id'], topic=topic, labels=decoded_payload['labels'])
return JSONResponse(content={"response": result}, status_code=200)
except Exception as e:

View file

@ -574,10 +574,10 @@ async def unlink_user_from_memory(user_id: str=None, labels:list=None, topic:str
raise ValueError("User ID is required.")
if not labels:
labels = ['sr'] # Labels for the memory node
raise ValueError("Labels are required, default label 'sr' provided")
if not topic:
topic = "PublicMemory"
raise ValueError("Topic is required, default topic 'PublicMemory' provided")
try:
neo4j_graph_db = Neo4jGraphDB(url=config.graph_database_url,