From ce622505eb8ff7c102178e4936fc0bc7dc053984 Mon Sep 17 00:00:00 2001 From: Yusuf Ali Date: Sat, 10 Jan 2026 15:56:14 +0000 Subject: [PATCH] fix: adding in retry logic sleep --- dist/index.js | 6 ++++-- index.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 6862dca..5a8bedf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32886,9 +32886,11 @@ async function post(requestPayload, retries=0) { } } catch(e){ if(retries < 5){ - return post(requestPayload, retries-1) + const delayMs = 1000 * (retries + 1); + await new Promise((resolve) => setTimeout(resolve, delayMs)); + return post(requestPayload, retries + 1); } - core.setFailed(`Error sending task to agent: ${error}`) + core.setFailed(`Error sending task to agent: ${e}`) } } diff --git a/index.js b/index.js index 742c28e..81acb07 100644 --- a/index.js +++ b/index.js @@ -54,9 +54,11 @@ async function post(requestPayload, retries=0) { } } catch(e){ if(retries < 5){ - return post(requestPayload, retries-1) + const delayMs = 1000 * (retries + 1); + await new Promise((resolve) => setTimeout(resolve, delayMs)); + return post(requestPayload, retries + 1); } - core.setFailed(`Error sending task to agent: ${error}`) + core.setFailed(`Error sending task to agent: ${e}`) } }