Handle null ref, when refresh conversation from db in websocket chat

This commit is contained in:
Debanjum Singh Solanky 2024-04-30 14:17:52 +05:30
parent 37879a7850
commit 9e068fad4f

View file

@ -338,6 +338,7 @@ async def websocket_endpoint(
await websocket.accept() await websocket.accept()
while connection_alive: while connection_alive:
try: try:
if conversation:
await sync_to_async(conversation.refresh_from_db)(fields=["conversation_log"]) await sync_to_async(conversation.refresh_from_db)(fields=["conversation_log"])
q = await websocket.receive_text() q = await websocket.receive_text()
except WebSocketDisconnect: except WebSocketDisconnect: