🐛 fix(chat.py): delete flow from cache if it already exists before initializing build
The code now checks if the flow already exists in the cache and deletes it before initializing the build. This ensures that the cache is always up to date and avoids any inconsistencies that may arise from having outdated data in the cache.
This commit is contained in:
parent
f0c507a660
commit
fc2e6c112e
1 changed files with 5 additions and 0 deletions
|
|
@ -39,6 +39,11 @@ async def init_build(graph_data: dict):
|
|||
|
||||
try:
|
||||
flow_id = graph_data.get("id")
|
||||
# Delete from cache if already exists
|
||||
if flow_id in chat_manager.in_memory_cache:
|
||||
with chat_manager.in_memory_cache._lock:
|
||||
chat_manager.in_memory_cache.delete(flow_id)
|
||||
logger.debug(f"Deleted flow {flow_id} from cache")
|
||||
if flow_id is None:
|
||||
raise ValueError("No ID provided")
|
||||
flow_data_store[flow_id] = graph_data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue