SShortSingh.
Back to feed

Retries Are Not Repeats: Five Idempotency Myths in Model-Backed Endpoints

0
·4 views

A developer article argues that a single 200 response from a model-backed endpoint does not reveal how many times the model actually executed. It explains that client timeouts are unknown outcomes rather than failures, since the server may still be processing or finish after the client gives up. The author recommends generating an idempotency key before the first attempt, reusing it across retries, and storing completed responses with a TTL so duplicates return a conflict instead of re-running. The piece also advises honoring 429 responses with Retry-After headers or jittered backoff, and avoiding retries on 400 or 422 errors that will not succeed. It further notes that free model access reduces token costs but not duplicate side effects, so retry budgets should be measured in time and effects. A standard-library Python lab is included to count real executions and test key-based deduplication.

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 ·

Five AI tools for personalized songs with someone's name, compared by price and use

Several AI services now let people create a custom song featuring a recipient's name, a niche that has grown in recent years. The article reviews five options: Suno, a general AI music app with free and paid tiers for experimenting, and Cantoro, a gift-focused generator with a one-time $4.99 download and no subscription. It also covers MelodyBolt, which offers a 60-second preview and custom songs from 9.99 GBP, GiftYourSong at $39.99 for a detailed story-based song, and GiftSong, starting at $34.99 with physical keepsake add-ons. The author, who built Cantoro, notes that prices were checked on 2026-11-07 and may change, and advises listening to the first minute before sharing a song.

0
ProgrammingDEV Community ·

Staging task reached production after loading a stray production token from a config folder

A demo scenario describes an internal workflow that drafts weekly support ticket summaries and runs in staging against a copy of the data. The task read a config folder to find the staging database address, and that folder contained an old .env.backup file holding a production token from a months-old migration. Because the job loads every file in the folder, it used the working credential and a draft ended up in the wrong place or a lookup hit the live system. The author argues that instructions saying "staging" are not a real boundary, and that access controls must be what keeps environments separate. The piece recommends auditing readable folders for stray credentials, issuing staging-only credentials, keeping early versions read-only with human approval, and testing whether production-looking calls fail loudly.

0
ProgrammingDEV Community ·

React Native or Native Development: Team Structure and Hardware Needs Should Decide

The article argues that choosing between React Native and native Swift or Kotlin should depend on hardware coupling, team organization, and cost timelines rather than developer preference or outdated performance concerns. It notes that standard business, commerce, and enterprise apps generally suit React Native, which lets one team share most code across platforms. Native development remains necessary for demanding cases such as computer vision, low-latency audio, specialized Bluetooth, and continuous background sensing. The author contends that old criticisms of React Native's bridge are obsolete because the New Architecture, with Fabric and TurboModules, removes much of the serialization bottleneck. The piece also warns that teams without native expertise may struggle when platform-specific build issues arise.

0
ProgrammingDEV Community ·

Backfill script fix: normalized title matching to stop repeat 422 errors on dev.to

A daily unattended publishing pipeline had a flaw where its skip check compared titles exactly, so titles containing × were not recognized as already published after dev.to normalized them to x. This caused re-submissions to fail with a 422 'Title has already been used' error, and one previously published post was incorrectly listed as pending. The author built a normalize_title() function that converts both local and platform titles to the same form before comparing, and tested it on 12 sample titles. Tests showed 4 of 5 same-meaning cases matched correctly, with the only miss being Traditional versus Simplified Chinese, a known limitation. The fix will be integrated into the backfill script with a cooldown safeguard.