Skip to content

Add RequiresStop interface and improve actor cleanup#5

Merged
molon merged 3 commits intomainfrom
requires-stop
Sep 1, 2025
Merged

Add RequiresStop interface and improve actor cleanup#5
molon merged 3 commits intomainfrom
requires-stop

Conversation

@molon
Copy link
Copy Markdown
Contributor

@molon molon commented Sep 1, 2025

Type of change

Description

Related issues

Notes for reviewer

@molon molon requested a review from Copilot September 1, 2025 02:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a RequiresStop interface to improve actor cleanup handling in the lifecycle package. The interface allows actors to indicate they need cleanup even if their Start method was never called, which is useful for actors that acquire resources during construction.

  • Adds RequiresStop interface with RequiresStop() bool method
  • Implements RequiresStop in FuncActor for actors with nil start but non-nil stop functions
  • Refactors cleanup logic to use a single defer block that handles both started actors and RequiresStop actors

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
lifecycle/lifecycle.go Adds RequiresStop interface and refactors Serve method to use unified cleanup logic
lifecycle/func.go Implements RequiresStop method in FuncActor
lifecycle/lifecycle_test.go Adds comprehensive tests for RequiresStop cleanup scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

molon and others added 2 commits September 1, 2025 10:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@molon molon merged commit 1ed2299 into main Sep 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants