simeononsecurity / glotta

Translate Hugo markdown file content and create index bundles
https://simeononsecurity.com/other/glotta-streamlining-hugo-text-translation-for-global-reach/
MIT License
2 stars 2 forks source link

implement retry logic utility which can be applied to any async function #12

Closed 1NF053C closed 1 year ago

1NF053C commented 1 year ago

I implemented this retry logic imperatively, hopefully this reduces amount of stack memory used vs recursive equivalent this withRetries function can be used on any async function. The "returned" function from withRetries can access the arguments provided to func via arguments https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments