Repository navigation
fix(sync-service): reduce live request wait memory - #4680
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4680 +/- ##
==========================================
- Coverage 60.20% 60.19% -0.01%
==========================================
Files 410 410
Lines 44378 44377 -1
Branches 12581 12580 -1
==========================================
- Hits 26716 26711 -5
- Misses 17584 17588 +4
Partials 78 78
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
736d823 to
be7aaa5
Compare
Claude Code ReviewSummaryRefactors the live long-poll wait in What's Working Well
Issues FoundCritical (Must Fix)None. Important (Should Fix)Does the structural split actually lower retained heap during the park? File: The PR's stated goal is that parking inside a narrow helper "keeps the parked receive from retaining the larger request-handling frame." But Because In other words, the memory win looks like it comes from the Suggestions (Nice to Have)
Issue ConformanceNo linked issue (flagged per convention — a tracking issue or incident link would help contextualize the memory-floor motivation), but the PR description is thorough and clearly enumerates the preserved behaviors. Implementation matches the described scope with no scope creep. Codecov reports all modified lines covered and no failing tests. Previous Review StatusN/A — first review of this PR. Review iteration: 1 | 2026-07-02 |
|
This PR has been released! 🚀 The following packages include changes from this PR:
Thanks for contributing to Electric! |
Motivation
Live shape requests spend most of their long-poll lifetime parked in a receive while waiting for either a shape change or timeout. Under high concurrency, parking inside the larger request-handling function kept more heap live than the small wait state actually needed, which made the per-request memory floor significant.
Changes
wait_for_live_change/2helper that only holds the change reference and timeout while parked.SystemMonitortimer fallback branch that Elixir 1.20 reports as unreachable under warnings-as-errors.Decisions
This keeps the waiter in the existing request process instead of introducing a central waiter registry. That avoids adding a new register/deregister bottleneck while still reducing the heap retained by parked live requests. The existing behavior is preserved for new changes, shape rotation, out-of-bounds checks, read-only timeout handling, and ordinary no-change responses.