TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Retry – A stateless, functional way to perform actions until successful

4 pointsby Rican7almost 9 years ago

1 comment

Rican7almost 9 years ago
I was looking for a well made and reusable &quot;retry&quot; library, but all I could find were libraries with awkward interfaces&#x2F;APIs, overuses of state&#x2F;pointers, a lack of extensibility, or they&#x27;d somehow opinionate themselves towards a specific purpose (HTTP retry libraries are in a major abundance).<p>So, I figured I&#x27;d take a stab at creating a retry library that worked in a simple loop with functional composition that would allow for easy extensibility. I ended up writing an API that somewhat heavily used the functional option pattern described so well by Dave Cheney in his blog post: &quot;Functional options for friendly APIs&quot; (<a href="http:&#x2F;&#x2F;dave.cheney.net&#x2F;2014&#x2F;10&#x2F;17&#x2F;functional-options-for-friendly-apis" rel="nofollow">http:&#x2F;&#x2F;dave.cheney.net&#x2F;2014&#x2F;10&#x2F;17&#x2F;functional-options-for-fri...</a>).<p>Ideally, the library&#x27;s packages can be used separately, so you could use the `jitter` transformations even if you don&#x27;t want to use the actual `retry` mechanism. That is why the library is split into a few packages.<p>Anyway, I&#x27;m curious as to what HN thinks about this library. Anything that I could definitely improve? Is there anything awkward about the API in particular? Something that I missed?<p>I appreciate the feedback! Thanks!