Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
YouTube Security VideosAndroid Police: Samsung is smashing records! #shorts #tech #phones(21.09.2026 um 13:55 Uhr)
YouTube Security Videosheise & c't: Bundesnetzagentur wollte diesen Futterautomaten verbieten(21.09.2026 um 13:53 Uhr)
YouTube Security VideosNeil Patel: Your Google Traffic Isn't An Asset It's A Loan #shorts(21.09.2026 um 14:05 Uhr)
Windows Tipps & SecurityF-14 A Tomcat Top Gun endlich als Revell Klemmbausteinmodell erhältlich(21.09.2026 um 14:27 Uhr)
Sichere ProgrammierungShow the Hand-Back Sample Before Approving an Agent Score(21.09.2026 um 14:15 Uhr)
Sichere ProgrammierungHybrid retrieval in one Postgres query: RRF over tsvector + pgvector(21.09.2026 um 14:15 Uhr)
YouTube Security VideosAndroid Police: Samsung is smashing records! #shorts #tech #phones(21.09.2026 um 13:55 Uhr)
YouTube Security Videosheise & c't: Bundesnetzagentur wollte diesen Futterautomaten verbieten(21.09.2026 um 13:53 Uhr)
YouTube Security VideosNeil Patel: Your Google Traffic Isn't An Asset It's A Loan #shorts(21.09.2026 um 14:05 Uhr)
Windows Tipps & SecurityF-14 A Tomcat Top Gun endlich als Revell Klemmbausteinmodell erhältlich(21.09.2026 um 14:27 Uhr)
Sichere ProgrammierungShow the Hand-Back Sample Before Approving an Agent Score(21.09.2026 um 14:15 Uhr)
Sichere ProgrammierungHybrid retrieval in one Postgres query: RRF over tsvector + pgvector(21.09.2026 um 14:15 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

houhou — Resilience Policies for TypeScript Async Functions

The problem Most resilience libraries in the TypeScript ecosystem are tied to HTTP clients (axios-retry, p-retry, Polly.js) or require wrapping your function in a class with a .execute() ceremony. What if you just want to wrap any async…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




The problem



Most resilience libraries in the TypeScript ecosystem are tied to HTTP clients (axios-retry, p-retry, Polly.js) or require wrapping your function in a class with a .execute() ceremony. What if you just want to wrap any async function — a database query, an internal service call, a file operation — with retry logic, a timeout, and a circuit breaker, without pulling in heavy dependencies?



Enter houhou.






What is houhou?



Houhou is a zero-dependency TypeScript library (~500 LOC) that wraps any async function with composable resilience policies. The wrapped function keeps the exact same signature — you call it like the original.




import { task } from 'houhou'

const charge = task(chargeCard)
.retry(3)
.timeout(10_000)
.fallback(() => ({ status: 'pending' }))

await charge(account, amount)









Policies at a glance






Retry



Re-execute on failure with fixed or exponential backoff:




task(fetchUser).retry(3) // shorthand

task(fetchUser).retry({
attempts: 5,
backoff: 'exponential',
jitter: true,
delay: 500
})









Timeout



Reject if the function doesn't complete in time:




task(fetchUser).timeout(5000)









Fallback



Run an alternative function on failure:




task(fetchUser).fallback(() => loadFromCache(id))









Circuit Breaker



Prevent repeated calls to an unhealthy service:




task(queryDb).circuitBreaker({
failureThreshold: 5,
successThreshold: 2,
resetTimeout: 30_000
})









Delay



Wait before execution:




task(syncData).delay(1000)









Policy ordering matters



Policies are nested: the last method called wraps the previous ones. Execution order is reverse of declaration order.




task(fn).retry(3).timeout(1000)
// → timeout wraps retry
// → function runs → retry on failure (up to 3 times) → 1s total timeout
// → if the timeout fires, there are no more retries









task(fn).timeout(1000).retry(3)
// → retry wraps timeout
// → function runs → 1s timeout → if timeout fires, retry catches it
// → the whole cycle repeats up to 3 times









Type safety — policy lock



Each method is lockable. TypeScript prevents configuring the same policy twice at compile time, and a runtime Set guard enforces it at runtime:




const t = task(fn).retry(3)

// @ts-expect-error — 'retry' is already locked
t.retry(2) // throws at runtime too









Cancellation with AbortSignal



Houhou uses AbortController to cancel operations when a timeout fires or an external signal is provided. The AbortSignal is passed as the last argument to your function:




const fn = (url: string, signal?: AbortSignal) => fetch(url, { signal })

task(fn).timeout(5000)('https://api.example.com')
// → timeout fires → controller.abort() → fetch is cancelled






You can also pass your own external signal:




const controller = new AbortController()
const promise = task(fn).timeout(5000).retry(3)('url', controller.signal)

controller.abort() // cancels everything









Composition example



Policies chain fluently in any order:




const resilient = task(callApi)
.retry({ attempts: 3, backoff: 'exponential' })
.timeout(5000)
.fallback(loadFromCache)
.circuitBreaker({ failureThreshold: 5, successThreshold: 2, resetTimeout: 30_000 })
.delay(100)









The name



"houhou" means "method" or "way of doing" in Japanese — fitting for a library about how you execute your functions.






Try it






npm install houhou
# or
pnpm add houhou
yarn add houhou






GitHub: https://github.com/smokeeaasd/houhou

npm: https://npmjs.com/package/houhou

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten houhou — Resilience Policies for TypeScript Async Functions

Thematisch verwandte Begriffe: houhou, Resilience, Policies, TypeScript · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94097 | A vulnerability was determined in Netcore NBR200V2 1.3.241127.071246. Th…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick