Idempotency when you don't control the other end
When an accounting or ERP API offers no idempotency key, a timed-out write leaves the caller unable to tell whether entries were booked, and the usual workarounds each fail in practice. Lookup by document number matches the wrong entry, because invoice numbers collide across suppliers and years. Check-before-write races against your own retries and against lagging search indexes, and it halves your rate-limit budget. After-the-fact cleanup means reversal entries that can themselves duplicate and that run into locked periods and filed VAT returns. The recommended fix sits with the provider: a proper idempotency key (409 for in-flight, 422 for a mismatched body, failed requests leave the key free) or at minimum a unique caller-reference field that returns 409 with the existing entry.
Related posts
- 10 Tips for Building Resilient Payment Systems
Shopify Engineering mediumAdeptTen lessons from Shopify's payment infrastructure for keeping payment systems reliable at scale. Start with low timeouts everywhere: about 1s to open a connection and 5s to read, write or query. Use circuit breakers via Semian, keyed per merchant country so one local acquirer outage stays isolated, and reason about capacity with Little's Law. Track the four golden signals, use structured logs with correlation IDs, and make retries safe with idempotency keys. ULID keys cut INSERT time by 50% versus UUIDv4. The rest covers reconciliation anomalies, load testing against a simulated benchmark gateway, checkout throttling, and incident management and retrospectives.
- Skipper, Airbnb’s embedded workflow engine, is now open source
Airbnb Engineering mediumAdeptAirbnb has open-sourced Skipper under Apache 2.0, an embedded durable workflow engine for Java and Kotlin that runs inside a service and stores workflow state in the service's existing database, with no separate orchestration cluster. Replicas run the runtime and a scheduler that polls for runnable tasks and coordinates ownership with leases. Interrupted workflows recover by replaying the workflow method from the top while reusing checkpointed action results, so workflow code must be deterministic and actions must be idempotent, since side effects remain at-least-once. Checkpoints are batched by default to cut database writes, with optional immediate checkpointing. The release includes MySQL and SQLite adapters, signals, timers, retries, Saga compensation, an in-memory test runtime and a state-machine DSL.
- Beyond rate limits: scaling access to Codex and Sora
OpenAI mediumAdept
OpenAI replaced hard rate-limit stops for Codex and Sora with a real-time access engine that treats rate limits, free tiers, credits, promotions and enterprise entitlements as layers in a single decision waterfall evaluated per request. Rate limits are consumed synchronously, and credits are checked in the same request but debited asynchronously through a streaming processor. Three chained datasets (product usage events, monetization events, balance updates) make every outcome auditable and replayable. Idempotency keys prevent double-debits, per-account serialized atomic transactions pair each balance decrement with an attributed record, and brief overshoots from the async delay are automatically refunded, trading strict enforcement for provable correctness.
- Build custom API integrations with incident.io
incident.io mediumAdeptincident.io launched a public API focused on three use cases: creating incidents automatically from other systems, exporting incidents and their actions and follow-ups to BI tools, and configuring roles, severities and custom fields from external sources such as Terraform. A worked example declares incidents from Zendesk by pairing a trigger with a webhook that POSTs JSON to /v1/incidents using Bearer-token auth. The create endpoint is deliberately permissive, so required custom fields are not enforced, and it requires an idempotency key so retries or repeated alerts produce only one incident.
- How we scaled the GitHub API with a sharded, replicated rate limiter in Redis
GitHub Engineering mediumAdeptGitHub replaced a Memcached-based API rate limiter, which suffered evictions and could not survive a move to per-datacenter caches, with application-sharded Redis clusters (one primary, several read replicas) and atomic Lua scripts, rolled out behind a feature flag. Two bugs followed. Deriving X-RateLimit-Reset from Redis TTL plus Ruby's clock made the header 'wobble' by a second. Lazy key expiration on replicas made reads return stale windows, so clients were rejected while seeing a full remaining quota. The fix was to store the reset-at timestamp explicitly, treat expired data as absent in application logic, keep Redis TTL only as cleanup one second later, and reuse the first read's result for response headers instead of making a second call.