Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: wrong usage of redis lock (#28177)
NeatGuyCoding1f2c85c916a8
diff --git a/api/services/trigger/webhook_service.py b/api/services/trigger/webhook_service.pyindex 5c4607d4005..4159f5f8f43 100644--- a/api/services/trigger/webhook_service.py+++ b/api/services/trigger/webhook_service.py@@ -863,10 +863,18 @@ class WebhookService:not_found_in_cache.append(node_id)continue- with Session(db.engine) as session:- try:- # lock the concurrent webhook trigger creation- redis_client.lock(f"{cls.__WEBHOOK_NODE_CACHE_KEY__}:apps:{app.id}:lock", timeout=10)+ lock_key = f"{cls.__WEBHOOK_NODE_CACHE_KEY__}:apps:{app.id}:lock"+ lock = redis_client.lock(lock_key, timeout=10)+ lock_acquired = False++ try:+ # acquire the lock with blocking and timeout+ lock_acquired = lock.acquire(blocking=True, blocking_timeout=10)+ if not lock_acquired:+ logger.warning("Failed to acquire lock for webhook sync, app %s", app.id)+ raise RuntimeError("Failed to acquire lock for webhook trigger synchronization")++ with Session(db.engine) as session:# fetch the non-cached nodes from DBall_records = session.scalars(select(WorkflowWebhookTrigger).where(@@ -903,11 +911,16 @@ class WebhookService:session.delete(nodes_id_in_db[node_id])redis_client.delete(f"{cls.__WEBHOOK_NODE_CACHE_KEY__}:{app.id}:{node_id}")session.commit()- except Exception:- logger.exception("Failed to sync webhook relationships for app %s", app.id)- raise- finally:- redis_client.delete(f"{cls.__WEBHOOK_NODE_CACHE_KEY__}:apps:{app.id}:lock")+ except Exception:+ logger.exception("Failed to sync webhook relationships for app %s", app.id)+ raise+ finally:+ # release the lock only if it was acquired+ if lock_acquired:+ try:+ lock.release()+ except Exception:+ logger.exception("Failed to release lock for webhook sync, app %s", app.id)@classmethoddef generate_webhook_id(cls) -> str: