Fix staticData error in workflow
- Remove dependency on $workflow.staticData which can be undefined - Pass retry_count through workflow data instead - Initialize retry_count in first node - Retry Counter now reads from input data
This commit is contained in:
parent
91b278c937
commit
04a47dc0ce
|
|
@ -11,7 +11,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"jsCode": "// Initialize workflow static data\nif (!$workflow.staticData.retries) {\n $workflow.staticData.retries = 0;\n}\n\nreturn {\n initialized: true,\n timestamp: new Date().toISOString()\n};"
|
"jsCode": "// Initialize retry counter in workflow data\nreturn {\n retry_count: 0,\n max_retries: 15,\n initialized: true,\n timestamp: new Date().toISOString()\n};"
|
||||||
},
|
},
|
||||||
"id": "init-workflow",
|
"id": "init-workflow",
|
||||||
"name": "Initialize Workflow",
|
"name": "Initialize Workflow",
|
||||||
|
|
@ -155,7 +155,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"jsCode": "// Retry counter with max retries\nconst retries = $workflow.staticData.retries || 0;\nconst maxRetries = 15; // 15 * 15s = ~4 minutes\n\nif (retries >= maxRetries) {\n throw new Error('Timeout: Agent did not start within 4 minutes');\n}\n\n$workflow.staticData.retries = retries + 1;\n\nconst convId = $('1. Create Conversation').item.json.conversation_id;\n\nreturn {\n conversation_id: convId,\n retry_count: retries + 1\n};"
|
"jsCode": "// Get retry count from input or default to 0\nconst currentRetries = $input.item.json.retry_count || 0;\nconst maxRetries = 15; // 15 * 15s = ~4 minutes\n\nif (currentRetries >= maxRetries) {\n throw new Error('Timeout: Agent did not start within 4 minutes');\n}\n\nconst convId = $('1. Create Conversation').item.json.conversation_id;\n\nreturn {\n conversation_id: convId,\n retry_count: currentRetries + 1\n};"
|
||||||
},
|
},
|
||||||
"id": "retry-counter",
|
"id": "retry-counter",
|
||||||
"name": "Retry Counter",
|
"name": "Retry Counter",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue