You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: Add force parameter to close method for immediate shutdown #294
Add a force parameter to the server's close() method to allow immediate shutdown that forcefully terminates in-flight requests.
Motivation
Currently, in-flight requests can potentially keep the server alive indefinitely during shutdown. While this may not be an issue in environments like Serverpod Cloud (where containers are force-terminated after a timeout), having a force parameter would make the API more complete and give users better control over shutdown behavior.
Proposed Solution
Add a force parameter (default: false) to the close() method that:
When false (default): Waits for in-flight requests to complete (current behavior)
When true: Immediately closes the server and forcefully terminates remaining connections
This approach allows users to implement their own timeout logic if needed:
// Example: Close with a 30-second timeoutFuture.any([
server.close(),
Future.delayed(Duration(seconds:30)).then((_) => server.close(force:true))
]);
Use Case
This is particularly useful for:
Self-hosted deployments where container orchestration behavior may vary
Scenarios where long-running requests should not delay server shutdown indefinitely
Production environments requiring predictable shutdown timing
Custom timeout implementations based on specific application needs
Context
This enhancement was suggested during testing of graceful shutdown behavior in PR #292, which verified that in-flight requests complete successfully during shutdown.
This would already be supported if we add a force parameter to the close method. Then the user could simply add a timeout for the close future that then calls close(force: true).
changed the title [-]Feature: Add configurable timeout for graceful shutdown[/-][+]Feature: Add force parameter to close method for immediate shutdown[/+]on Dec 19, 2025
#!/bin/bash
# Fetch the details of issue #294 to see the current description
gh issue view 294 --json title,body,number
Length of output: 1473
🏁 Script executed:
#!/bin/bash
# Update the issue title and body to reflect the force parameter approach
gh issue edit 294 \
--title "Feature: Add force parameter to close method for immediate shutdown" \
--body "## Feature Request
Add a \`force\` parameter to the server's \`close()\` method to allow immediate shutdown that forcefully terminates in-flight requests.
## Motivation
Currently, in-flight requests can potentially keep the server alive indefinitely during shutdown. While this may not be an issue in environments like Serverpod Cloud (where containers are force-terminated after a timeout), having a \`force\` parameter would make the API more complete and give users better control over shutdown behavior.
## Proposed Solution
Add a \`force\` parameter (default: \`false\`) to the \`close()\` method that:
- When \`false\` (default): Waits for in-flight requests to complete (current behavior)
- When \`true\`: Immediately closes the server and forcefully terminates remaining connections
This approach allows users to implement their own timeout logic if needed:
\`\`\`dart
// Example: Close with a 30-second timeout
Future.any([
server.close(),
Future.delayed(Duration(seconds: 30)).then((_) => server.close(force: true))
]);
\`\`\`
## Use Case
This is particularly useful for:
- Self-hosted deployments where container orchestration behavior may vary
- Scenarios where long-running requests should not delay server shutdown indefinitely
- Production environments requiring predictable shutdown timing
- Custom timeout implementations based on specific application needs
## Context
This enhancement was suggested during testing of graceful shutdown behavior in PR #292, which verified that in-flight requests complete successfully during shutdown.
## Related
- PR: https://github.com/serverpod/relic/pull/292
- Requested by: @nielsenko"
echo "Issue #294 has been updated successfully"
Length of output: 86
@SandPod, I've successfully updated issue #294 to request a force parameter for the close() method instead of a configurable timeout parameter.
Changes made:
Title: Changed to "Feature: Add force parameter to close method for immediate shutdown"
Description: Updated to propose a force parameter (default: false) that allows immediate shutdown when set to true
Example: Added a code example showing how users can implement their own timeout logic by combining Future.any with close(force: true)
The updated approach gives users more flexibility to implement custom timeout behavior while keeping the API simpler. You can view the updated issue here: #294
Activity
SandPod commentedon Dec 19, 2025
This would already be supported if we add a
forceparameter to the close method. Then the user could simply add a timeout for the close future that then callsclose(force: true).SandPod commentedon Dec 19, 2025
@coderabbitai - Please update this feature request so that it request a
forceparameter to the close method instead as suggested by the comment above.[-]Feature: Add configurable timeout for graceful shutdown[/-][+]Feature: Add force parameter to close method for immediate shutdown[/+]coderabbitai commentedon Dec 19, 2025
🧩 Analysis chain
🏁 Script executed:
Length of output: 1473
🏁 Script executed:
Length of output: 86
@SandPod, I've successfully updated issue #294 to request a
forceparameter for theclose()method instead of a configurable timeout parameter.Changes made:
forceparameter (default:false) that allows immediate shutdown when set totrueFuture.anywithclose(force: true)The updated approach gives users more flexibility to implement custom timeout behavior while keeping the API simpler. You can view the updated issue here: #294