Skip to content

feat(152) Implement Async.withGracefulShutdown for graceful shutdown#154

Merged
rcardin merged 16 commits into
v0.12.0from
152-implement-asyncrundaemon-with-graceful-shutdown
Jan 14, 2026
Merged

feat(152) Implement Async.withGracefulShutdown for graceful shutdown#154
rcardin merged 16 commits into
v0.12.0from
152-implement-asyncrundaemon-with-graceful-shutdown

Conversation

@rcardin
Copy link
Copy Markdown
Owner

@rcardin rcardin commented Jan 12, 2026

Closes #152

@rcardin rcardin self-assigned this Jan 12, 2026
@rcardin rcardin added enhancement New feature or request yaes-core YAES core effects labels Jan 12, 2026
@rcardin rcardin linked an issue Jan 12, 2026 that may be closed by this pull request
@rcardin rcardin requested a review from Copilot January 12, 2026 16:57
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 pull request implements the Async.withGracefulShutdown handler for coordinating graceful shutdown in long-running applications. The PR introduces a new Shutdown effect that manages shutdown state and callback hooks, and integrates it with the Async effect through a specialized GracefulShutdownScope that enforces deadline-based shutdown.

Changes:

  • Added Shutdown effect with thread-safe state management, hook registration, and automatic JVM shutdown hook integration
  • Implemented GracefulShutdownScope extending StructuredTaskScope to coordinate graceful shutdown with timeout enforcement
  • Added Async.withGracefulShutdown handler combining Async and Shutdown effects with configurable deadline

Reviewed changes

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

Show a summary per file
File Description
yaes-core/src/main/scala/in/rcard/yaes/Shutdown.scala New Shutdown effect implementation with state management, hooks, and JVM integration
yaes-core/src/main/scala/in/rcard/yaes/Async.scala Added GracefulShutdownScope and withGracefulShutdown handler for deadline-enforced shutdown
yaes-core/src/test/scala/in/rcard/yaes/ShutdownSpec.scala Comprehensive tests for Shutdown effect covering state transitions, hooks, concurrency, and edge cases
yaes-core/src/test/scala/in/rcard/yaes/AsyncWithGracefulShutdownSpec.scala Integration tests for graceful shutdown including timeout enforcement, fiber coordination, and exception handling
docs/effects/shutdown.md Complete documentation for Shutdown effect with examples and best practices
docs/effects/async.md Added graceful shutdown section documenting lifecycle, behavior, and usage patterns
docs/effects/index.md Added Shutdown effect to effects index
docs/_sidebar.md Added Shutdown effect to documentation navigation
README.md Updated with Shutdown effect overview and Async.withGracefulShutdown usage example
CLAUDE.md Updated project structure to include Shutdown effect

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread yaes-core/src/main/scala/in/rcard/yaes/Async.scala Outdated
Comment thread docs/effects/async.md
Comment thread yaes-core/src/main/scala/in/rcard/yaes/Async.scala
rcardin and others added 3 commits January 12, 2026 21:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 12, 2026

@rcardin I've opened a new pull request, #155, to work on those changes. Once the pull request is ready, I'll request review from you.

@rcardin rcardin requested a review from Copilot January 12, 2026 20:13
@rcardin rcardin changed the base branch from main to v0.12.0 January 12, 2026 20:15
Clarify timeout enforcer design in `Async.withGracefulShutdown`
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread docs/effects/async.md
Comment thread README.md
Comment thread yaes-core/src/main/scala/in/rcard/yaes/Async.scala Outdated
Comment thread yaes-core/src/main/scala/in/rcard/yaes/Async.scala Outdated
rcardin and others added 3 commits January 12, 2026 21:20
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread yaes-core/src/main/scala/in/rcard/yaes/Async.scala
Comment thread README.md
Comment thread yaes-core/src/main/scala/in/rcard/yaes/Async.scala Outdated
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rcardin rcardin merged commit 10b80da into v0.12.0 Jan 14, 2026
7 checks passed
@rcardin rcardin deleted the 152-implement-asyncrundaemon-with-graceful-shutdown branch January 14, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request yaes-core YAES core effects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Async.withGracefulShutdown with graceful shutdown

3 participants