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

推荐订阅源

L
LangChain Blog
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
D
Docker
WordPress大学
WordPress大学
罗磊的独立博客
J
Java Code Geeks
博客园 - 【当耐特】
博客园 - 司徒正美
雷峰网
雷峰网
H
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
T
Tailwind CSS Blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
Recent Announcements
Recent Announcements
B
Blog

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"