≈ the.bay.news

*"How I Fixed a 30-Second Timeout in a High-Latency API Call (Without Throwing Away the Data)"*

DEV Community
*"How I Fixed a 30-Second Timeout in a High-Latency API Call (Without Throwing Away the Data)"*
A client’s ASP.NET Core API was timing out on a third-party payment processor with inconsistent latency—sometimes 50ms, sometimes 30 seconds. The business couldn’t afford to lose transactions, but retrying blindly risked duplicate charges. Here’s how I implemented a **time-based retry with idempotency keys** using `IAsyncPolicy` and `Polly`, while ensuring failed requests were logged for manual review. The solution reduced timeouts by 80% without sacrificing data integrity. Key takeaways: when to use retries vs. dead-letter queues, how to handle partial failures gracefully, and why `CancellationToken` is your best friend in async hell.

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.