Stop Paying for Async Work That Should Have Been Cancelled

https://hackernoon.imgix.net/images/4Pd5EwqsvDbKNP5rkqpvRfPXx1h1-7w83cna.png

Concurrency, Retry, And Timeout Under One Owner.

Last time we showed work(items).inParallel(8).withRetry(3).withTimeout("5s").do(fn) — the one-line fluent surface for processing a list. That handles the 80% case.

Check Owned Async Work in TypeScript — Promise.race does not cancel your work and Your AI Is Still Billing After the User Closed the Tab in case you missed them.

This article is about the other 20%: orchestrating heterogeneous tasks that race, fall back, hedge, and retry — with ownership.

Open package.json in enough AI codebases and you'll see combinations like these – or completely different helpers – depending on who wrote the stack:

"p-limit": "^5.0.0","p-map": "^7.0.0","p-retry": "^6.2.0","p-timeout": "^6.1.2","p-queue": "^8.0.1","bottleneck": "^2.19.5","async-retry": "^1.3.3"

Six libraries is just one example. Some teams roll their own Promise.race loops. Others use async helpers from lodash or bluebird. The pattern is the same: scattered concurrency primitives with no shared ownership.

When a sibling throws, when a timeout fires,...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE