hatchet icon indicating copy to clipboard operation
hatchet copied to clipboard

fix: listener v2 status race

Open grutt opened this issue 7 months ago • 1 comments

Description

This addresses the race condition where multiple listeners can interfere with each other's active status

Race condition scenario:

  1. Worker A establishes ListenV2 connection, sets worker active=true with timestamp T1
  2. Worker B establishes ListenV2 connection, sets worker active=true with timestamp T2 (T2 > T1)
  3. Worker A disconnects, sets worker active=false with timestamp T1
  4. Since T1 <= T2, the database update succeeds and worker is marked inactive
  5. Worker B is still connected but worker appears inactive, causing heartbeat rejections

This polling goroutine ensures that as long as ANY ListenV2 connection is active, the worker status remains active=true, preventing the race condition

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

grutt avatar Jun 12 '25 12:06 grutt

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
hatchet-docs Ready Ready Preview Comment Sep 11, 2025 3:43pm
hatchet-v0-docs Ready Ready Preview Comment Sep 11, 2025 3:43pm

vercel[bot] avatar Jun 12 '25 12:06 vercel[bot]