⚖ Compare news

Put up to three stories side by side. Pick IDs from any article URL: /compare?id=123&id=456

Вебхук пришёл дважды: почему SELECT перед INSERT не спасает от повторного начисления

habrahabr.ru ·Russian Federation · world
Words
45
Chars
328
AI summary
Yes
Full story

A handler increased a balance, but its response was lost, so the sender repeated the webhook and the balance increased again. The article examines protection using Python and SQLite, including a unique key and a shared transaction. It also covers reproducible tests for repeated and parallel delivery, plus a crash during processing and the same key with different content.

Обработчик увеличил баланс, но ответ потерялся. Отправитель повторил вебхук — и баланс вырос ещё раз. Разбираем защиту на Python и SQLite: уникальный ключ, общая транзакция и воспроизводимые тесты повторной и параллельной доставки. Заодно проверим падение посередине обработки и одинаковый ключ с разным содержимым. Читать далее

Open article