Skip to content

refactor: deduplicate ChildSpec and extract RestartIntensityTracker [3/6]#104

Closed
unbalancedparentheses wants to merge 9 commits intolambdaclass:mainfrom
unbalancedparentheses:pr/3-dedup-restart
Closed

refactor: deduplicate ChildSpec and extract RestartIntensityTracker [3/6]#104
unbalancedparentheses wants to merge 9 commits intolambdaclass:mainfrom
unbalancedparentheses:pr/3-dedup-restart

Conversation

@unbalancedparentheses
Copy link
Contributor

Summary

Small refactoring to reduce code duplication in supervisor:

  • ChildSpec deduplication: Extract new_with_type() helper for cleaner child spec creation
  • RestartIntensityTracker: Extract restart tracking logic to dedicated struct for reuse

Changes

  • ~140 lines changed in supervisor.rs

Dependencies

⚠️ Merge after PRs #102 and #103

Test plan

  • All 79 existing tests pass
  • Runs with --test-threads=1

🤖 Generated with Claude Code

unbalancedparentheses and others added 9 commits January 8, 2026 02:23
- Extract ChildSpec::new_with_type() helper to remove duplication
  between worker() and supervisor() constructors
- Add RestartType::should_restart() method to centralize restart
  decision logic used in both Supervisor and DynamicSupervisor

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract the restart intensity checking logic into a shared
RestartIntensityTracker struct, eliminating duplication between
Supervisor and DynamicSupervisor.

The tracker encapsulates:
- Recording restart timestamps
- Pruning old restart times
- Checking if more restarts are allowed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@unbalancedparentheses
Copy link
Contributor Author

Closing: Replaced by new PR sequence #105-#107 with Backend enum first approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant