惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Y
Y Combinator Blog
F
Fortinet All Blogs
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
博客园 - Franky
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
量子位
博客园 - 三生石上(FineUI控件)
I
InfoQ
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
D
Docker
美团技术团队
雷峰网
雷峰网
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理

HN's home page

Rainbow Query Language | Hacker News Exec into Node via Kubectl An AI native hedge fund The Seven-Action Documentation Model | Hacker News Package Manager for Kubectl Plugins Tongan Castaways | Hacker News Tech overlords plan for conscious AI to conquer the cosmos. What could go wrong? Data Breach Disclosure Lag Is Getting Worse How LLMs Work | Hacker News I Dropped PRDs for Shape Up Go Experiments Explained | Hacker News FCA's Palantir deal could expose UK financial data to Trump's US, critics fear WebXR BCI for Neural-Adaptive Avatar Control in Mixed Reality The first murder conviction via DNA analysis Tom Interviews Theo de Raadt of the OpenBSD Project (2019) [video] Show HN: Replace shell commands with bun shell typescript scripts Quay.io Is Down | Hacker News AI driven analysis of brokerage account fees in the UK Bill Gates Spent Years Crafting His Image. Now It's Cracking Using LLMs to secure source code Wi-Fi 8 in the Lab [video] The household battery revolution that could change energy bills and the world Is Python Becoming Pinyin? | Hacker News Livia – Executive Assistant | Hacker News FindMyPipe – Query Apple Find My from Linux for AI Agents Show HN: Agent skill for creating product launch videos with Remotion RecruitMyself – AI job search copilot for resumes and applications AI coding agents and the erosion of system understanding The 'Resting' Generation and South Korea's Youth Recession AMD Computex 2026: 10 Years of AM4, AM5 Support Through 2029
Show HN: Sentinel – prevent duplicate execution using Pos...
Sreejay_redd · 2026-06-17 · via HN's home page

A customer is charged twice, data is processed twice in an ETL pipeline or hundreds of other scenarios when you have to atomically analyse your code to prevent race conditions. Most teams use Redis Setnx or have homegrown lease tables and idempotency tables, try to make every endpoint idempotent or check and update in the same transaction or adopt very heavy commitment infra what if you could do it with just postgres ? I had to do the same, an idempotency table with states with the frontend sending a randomised session id Made my endpoint that receives payment webhooks always check and update This was annoying, to say the least to do across inventory, orders and payments My entire infrastructure depends on postgres select for update and wherever i forgot to put it, say across a direct order or cart order, a race condition lives So i made Sentinel, zero infra just postgres, it makes any endpoint you wrap it around functionally idempotent, it's caches the result and replays it, handles the entire life cycle from the work being claimed till completion with any errors being surfaced with reconciliation tooling Uses fencing tokens to throw out stale work, leases and heartbeat for the lifetime of the work and states to track progress.

from sentinel import Sentinel import psycopg

sentinel = Sentinel(get_conn=get_conn)

def process_payment_webhook(charge_id: str, amount: int): result = sentinel.once( key=f"stripe-webhook:{charge_id}", fn=charge_customer, kwargs={"charge_id": charge_id, "amount": amount}, ttl_ms=5000, hard_ttl_ms=30000 )

    if result.execution_alive:
        # Another worker is actively processing this charge
        return {"status": "processing"}

    elif result.uncertain:
        # Execution failed midway, side effects may have partially applied
        # Use reconciliation tooling to inspect and resolve
        return {"status": "uncertain", "reconcile": result.reconcile}

    else:
        # Newly completed or replayed from cache
        # Safe to return regardless of how many times this webhook fired
        return {"status": "ok", "response": result.response}
 

AsyncSentinel is available for async contexts.

Temporal and Airflow assume your tasks are idempotent. Sentinel is what makes them actually idempotent.

"GitHub: github.com/Sreejay-Reddy/Sentinel | pip install sentinel-coordination"