Skip to content

Commit

Permalink
fix: timeout klevu custom api (#241)
Browse files Browse the repository at this point in the history
* fix: correct attempts

* chore: add changeset
  • Loading branch information
field123 authored Aug 23, 2024
1 parent 49aedbc commit d25f938
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-trees-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"composable-cli": patch
---

Correct timeout used
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ export async function setupKlevuCustomApiEntryTasks(
task: async () => {
// Wait for the klevu custom api to be created by the integration
const customApi = await backOff(
() => fetchCustomApi(ctx.requester, "klevu-keys"),
() =>
fetchCustomApi(ctx.requester, "klevu-keys").then((res) => {
if (res === null) {
throw new Error("Result was null")
}
return res
}),
{
startingDelay: 2000,
maxDelay: 60000,
retry: (result) => {
// Retry if the result is null
return result === null
},
numOfAttempts: 5,
},
)

Expand Down

0 comments on commit d25f938

Please sign in to comment.