Commit f4cf790
[Feature] Add journey state cleanup to scheduler (PR #3/9)
Extends the centralized cleanup method to handle journey tracing state
alongside core span cleanup. Fixes memory leak on natural completion path.
Changes:
- Extend _end_core_span_and_cleanup() with decoupled cleanup logic
- Cleanup #1: Core spans (always runs, independent of flags)
- Cleanup #2: Journey state (only if journey tracing enabled)
- Remove duplicate inline cleanup from finish_requests()
- Add 4 tests verifying state cleanup on all termination paths
Tests:
- test_journey_state_created: Verify state initialization
- test_journey_state_cleaned_on_finish: Explicit abort cleanup
- test_journey_state_cleaned_on_completion: Natural completion cleanup
- test_no_state_leak: No accumulation over 20 iterations
All 95 tests passing (4 new + 91 existing).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 91f780f commit f4cf790
3 files changed
Lines changed: 542 additions & 184 deletions
0 commit comments