SShortSingh.
Back to feed

Check-then-call billing creates a race condition that can overspend under concurrency

0
·6 views

A common credit-system pattern checks the balance, calls a provider, then debits, which passes serial tests but fails under concurrent requests. Simultaneous requests all read the same balance before any debit occurs, so they all proceed and the balance can drop below zero. The article argues that debiting first, serialising everything, or reconciling later are inadequate fixes. Instead it proposes reserve-and-settle: holding the maximum estimated cost before contacting the provider, then replacing the hold with the real cost and releasing the difference. The approach is recommended for LLM gateways, where concurrent traffic is the norm, and can be validated by firing many simultaneous requests at a tiny balance.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Keycloak Operator Flaw CVE-2026-137944 Exposes Proxy Credentials in Kubernetes

CVE-2026-137944 is a credential-disclosure flaw in the Red Hat Build of Keycloak Operator, which runs inside Kubernetes and manages Keycloak services. The operator does not normally expose a public web listener, so internet searches for Keycloak reveal identity services but cannot show whether the operator itself is affected. The article argues that the real risk lies in the cluster's control plane, where proxy values may be copied into StatefulSet specs in plain text. Recommended steps include reviewing RBAC and audit logs, rotating proxy passwords if clear values were exposed, verifying the vendor fix, and adding policies that flag credential-bearing URLs in workload environment variables.

0
ProgrammingDEV Community ·

Python DNS Automation: When Mail Evidence Justifies a Provisioning Pipeline

The article argues that a property management platform should verify mail authentication before automating DNS record changes for customer domains. It suggests keeping occasional, reviewed changes in manual consoles until a repeatable verification process exists. Automation is justified when onboarding repeatedly collects the same evidence and applies the same approval rules. The author stresses that DMARC alignment, not just a passing SPF or DKIM check or a DNS screenshot, is the key evidence to preserve. Verification records should keep the relevant identifiers, alignment mode, and result source for operator review.

0
ProgrammingDEV Community ·

Softsasi Releases Six Open-Weight LLMs for English, Bangla, and Romanized Banglish Software

Softsasi NextGen Research has fine-tuned and open-sourced six purpose-sized language models, ranging from 0.8B to 24B parameters, under the Apache-2.0 license. The team built them because monolithic APIs struggle with cost, latency, and the code-switching common in Bangladesh, where users mix English, Bengali script, and Romanized Banglish. Each model is matched to a specific software task, such as search expansion, claim verification, SQL-based business analytics, order handling, board planning, and legal document generation. The models are supported by a 430-case evaluation suite and a technical report, and they are already used in products including a hospital management system and an ERP. Production user data was scrubbed from the training datasets to protect personal information.

0
ProgrammingDEV Community ·

Developer releases five open-source tools built on Brazil's tax reform calculators

A developer has built five independent open-source projects around the RTC calculators published by Brazil's Receita Federal, which cover the CBS, IBS and Selective Tax under the country's tax reform. The tools include an MCP server for AI agents, an AI tax copilot, a FastAPI gateway with Python and TypeScript SDKs and a CLI, a web simulator comparing tax regimes, and a batch auditor for invoice files. All projects are released under the MIT license and are not affiliated with the Receita Federal. The creator stresses that the tools are not tax advice and urges users to consult legislation and an accountant. The developer invites feedback, issues and contributions to guide future development.