{"version":"2.1.274","anchor":"gateway-server-gains-a-graceful-drainshutdown-path","canonical_anchor":"gateway-server-gains-a-graceful-drainshutdown-path","heading":"Gateway server gains a graceful drain\/shutdown path","tier":"internal","area":"Gateway","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.274\/e\/gateway-server-gains-a-graceful-drainshutdown-path","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.274","markdown":"### Gateway server gains a graceful drain\/shutdown path\n\nLocal managed-gateway server gains a graceful drain step before shutdown\n\n**What**\n\nThe local gateway server that Claude Code runs to manage API requests now tracks how many requests are still in flight and adds a `drain` method (alongside the existing `stop`) that stops accepting new work, waits for pending requests up to a timeout, flushes billing\/metering data, and reports how many requests were still pending when it finished. The server also now checks whether a request originated from an internal\/in-VPC address for logging purposes, and its housekeeping reports now include an `outboundLimit` value.\n\nSeparately, the server-side billing and spend-limit code now tracks in-flight spend-check and metering work and exposes a `flush` function that waits for all of it to finish before the process exits, using a timeout-bound abort mechanism for the spend-check request itself.\n\n**Why**\n\nThis reduces the chance of losing in-flight requests or billing\/metering data when the gateway shuts down, ensuring usage is accurately recorded rather than dropped mid-request.\n\n- Area: Gateway\n- Tier: Under the hood\n- Useful: 1\/5\n- Signal: 1\/5"}