feat(152) Implement Async.withGracefulShutdown for graceful shutdown#154
Conversation
…mplify task completion handling
…ers and exception propagation
There was a problem hiding this comment.
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
Shutdowneffect with thread-safe state management, hook registration, and automatic JVM shutdown hook integration - Implemented
GracefulShutdownScopeextendingStructuredTaskScopeto coordinate graceful shutdown with timeout enforcement - Added
Async.withGracefulShutdownhandler combiningAsyncandShutdowneffects 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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Clarify timeout enforcer design in `Async.withGracefulShutdown`
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nitiating the shutdown
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Closes #152