Siparislerim Square de iki defa gozukuyordu pos-sync idempotency claims — QQ F3 (PR #551)
Adana Seyhan Ziyapasa Bulvari 43-yas Adana Sissi Bey Adana Kebabi 50-cover 19-yil geleneksel Adana kebabi + lahmacun + salgam suyu sahibi Behlul thMenu Pro 18 ay Square POS 6 ay shipped. Cumartesi aksami 21:00 Adana rush hour kapanis Square dashboard gunluk satis 87 siparis dun 84 ama bu sabah sali 4-5 sadece olamaz transaction list 6 siparis iki defa ayni tutar ayni item ayni table_id 30-60 saniye arayla. Behlul Square processing fee 2x her duplicate 6 × $5 = $30 fee Square accounting end-of-day reconciliation thMenu vs Square gross uyumsuz KDV reporting Square overcounted. Support yazdi. Engineering 7-gun POS sync log cron retry ayni order iki defa push 30 dakika pending POS push drain Square API timeout 5xx retry UPDATE pos_sync_queue SET attempts +1 push idempotency yok Square idempotency-key header thMenu set etmiyor ilk push pending takılırsa retry yeni request Square iki ayri transaction. 3 yanlis teori (1) Square API debounce Square debounce yok idempotency-key bekliyor yanlis katman; (2) retry-after backoff exponential timing degistirmek yavaslatir engellemez duplicate riski; (3) pos_sync_queue UNIQUE constraint ekle helper ama yetmez INSERT engeller UPDATE retry attempt kontrol etmez Square API idempotent gonderildigi belli olmali. Dogru pattern Square API idempotency-key + pos_sync_queue UNIQUE + claim-before-push pattern PR #310 + PR #341 + PR #606 CCC F1 cron_idempotency_claims sibling. Adli analiz cloudflare/src/cron-jobs/pos-sync.ts pending SELECT 50 row push try/catch update attempts pushToSquare Square idempotency-key header yok Square Idempotency-Key UUID 24h server-side dedup retry tek transaction. pos_sync_queue UNIQUE (order_id, provider) constraint yoktu migration 0027 yeni eklendi eski schema id PK + order_id INDEX iki paralel cron tick ayni order INSERT duplikatif rows pratik olarak az olasi. Behlul 7-gun audit 6 duplicate hepsi cron retry pattern Square API timeout + retry duplicate transaction production-wide 90-gun 47 restaurant 312 duplicate Square transaction. PR #551 batch QQ F3 3-katmanli fix Layer 1 Square API idempotency-key header pushToSquare const idempotencyKey = posSync:order_id:provider stable key 24h Square dedup retry tek transaction. Layer 2 D1_OPS migration 0027 UNIQUE (order_id, provider) partial UNIQUE WHERE status IN (pending, failed) success/dead duplikate izin historical record INSERT race condition DB UNIQUE constraint engeller. Layer 3 claim-before-push pattern PR #310 sibling cron_idempotency_claims claimKey pos-sync:order_id:provider:gun INSERT OR IGNORE meta.changes=0 skip gunde bir claim defense-in-depth Square idempotency-key. Production audit + backfill Behlul 6 duplicate Square Refunds API full refund + processing fee geri 47 restaurant 312 duplicate 287 Square refund cleanup window + 25 dispute fast-track Square TR engineering ozel kanal toplam ~$1560 processing fee recovered 47 operator 1-ay Pro tier credit + apology email. Post-deploy 30-day 0 yeni duplicate Square transaction pos-sync cron retry idempotency-key + claim-before-push correctly handle UNIQUE constraint race condition DB layer. Aoibhinn Dublin Temple Bar 38-yo 14-yr The Brazen Head Gastropub 55-cover Irish pub + Square POS 7-month paralel pattern 18 duplicate £81 fee aynı fix. Pattern Cloudflare cron at-least-once delivery external API write (Stripe Square Wise Resend Lightspeed) BOTH idempotency-key header + DB UNIQUE constraint + claim-before-push pattern defense-in-depth zorunlu tek tane yetmez. Sibling sweep pos-sync QQ F3 + daily-ops-digest PR #310 + ingredient-reorder-alert PR #341 + email-drips PR #341 + inventory-predict-notify PR #341 + PR #606 CCC F1 + aff-postback-retry PR #493 R + PR #609 CCC-B + apply-loyalty PR #553 QQ-B F2 + scanFor1099Threshold PR #536 LL. Implementation cron at-least-once identify + idempotency-key header stable + DB UNIQUE partial WHERE active + claim-before-push cron_idempotency_claims + sync exception releaseClaim PR #606 CCC F1 + audit log + PR template checkbox + quarterly cron retry audit. PR #551 referans.
thMenu Ekibi
thmenu.com
Faydalı buldunuz mu? Paylaşın.
İlgili makaleler
Müşteri Aboneliğini Düşürünce Eski Özellikler Ne Olur? — SaaS Sessiz Feature-Drift Problemi
Çoğu SaaS abonelik tier’ı düştüğünde tek satır kod çalıştırır ama eski özellikle…
JWT alg-confusion atağı — Supabase HS256'dan RS256/JWKS'e geçince eski verifier'lar neden yıkılır?
JWT header'ı decode etmeyen verifier'lar `alg=none` ve `alg-confusion` saldırıla…
Her bakiye değişikliğinin neden bir 'journal row'u olmalı? — SaaS finansal audit'in temel taşı
SaaS bakiyeleri tek satır UPDATE ile yönetince "drift var ama HANGİ mutasyon yan…