hatchet
hatchet copied to clipboard
fix: listener v2 status race
Description
This addresses the race condition where multiple listeners can interfere with each other's active status
Race condition scenario:
- Worker A establishes ListenV2 connection, sets worker active=true with timestamp T1
- Worker B establishes ListenV2 connection, sets worker active=true with timestamp T2 (T2 > T1)
- Worker A disconnects, sets worker active=false with timestamp T1
- Since T1 <= T2, the database update succeeds and worker is marked inactive
- 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)
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| hatchet-docs | Preview | Comment | Sep 11, 2025 3:43pm | |
| hatchet-v0-docs | Preview | Comment | Sep 11, 2025 3:43pm |