{
  "id": 15128080,
  "title": "Make generation quotas safe to retry",
  "url": "https://urgent.news/2026/10/17/make-generation-quotas-safe-to-retry",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-17T05:22:19.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/prem_peswani_4222579c915d/make-generation-quotas-safe-to-retry-1eg3"
  },
  "original_language": "en",
  "account": "Web applications that interact with slower services must manage a common issue: server responses may vanish from the browser before reaching it. If a user attempts to re-perform an action, the backend could treat the retry as a distinct operation, resulting in the same request using up quota or generating duplicate output. To prevent this, it's beneficial to assign each intended operation a stable idempotency key. The server should record this key before starting any resource-intensive tasks. When faced with a repeated request featuring the same key, the server should return the current state of the operation instead of initiating a new one. An effective model for the state of operations could be: reserved - completed - failed. This reservation should be specific to the user and the operation in question. Additionally, an alternate operation ID can enable the client to inquire about the operation's status after a certain timeout. The user interface can subsequently display \"still processing,\" \"completed,\" or \"failed\" depending on the state of the operation recorded by the server, rather than the user assuming it from the button click.\n\nHowever, an upstream timeout is a particularly tricky scenario. A timeout does not always signify that the service provider did not perform any work. Before releasing a reservation or initiating a fresh provider request, it's crucial to ascertain whether the original operation can be discovered or safely retried using the identical idempotency key. Failing to do so could transform a timeout into a situation of duplicated work.\n\nThis approach is a design pattern, not an assertion about any specific product implementation. The appropriate quota rule hinges on the product's promise: whether a failed attempt incurs a charge, whether pending work reserves capacity, and how long an operation can remain unresolved without resolution. These choices must be explicitly stated, and then tested under various conditions such as concurrent starts, browser retries, provider timeouts, and delayed responses.",
  "summary": "Any web action that calls a slower service has to handle a familiar failure: the server may finish the work, but the response can disappear before the browser receives it. If a user retries and the backend treats the retry as a new operation, the same request may consume quota twice or create duplicate output. A button being clicked once does not guarantee one request reached the server. A useful…",
  "key_points": [
    "Assign unique idempotency key to each operation to prevent duplicate work on retries.",
    "Server records operation state (reserved, completed, failed) before resource-intensive tasks.",
    "Timeout does not always mean no work; verify if original operation can be safely retried."
  ],
  "editors_take": "Implementing stable idempotency keys protects users from duplicate charges and wasted resources by ensuring that repeated requests for slow services return existing operation states instead of triggering new tasks.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}