-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance Pode Server with Suspend, Resume, and Advanced Console Features #1461
base: develop
Are you sure you want to change the base?
Conversation
…s and Pipeline Support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all the code, just not the docs.
Also, I'm guessing you've edited some of this outside of VSCode? As the auto-formatting in some files seems to have not triggered 🤔
$protocolLabel = switch ($protocol) { | ||
'HTTP' { 'HTTP ' } | ||
'HTTPS' { 'HTTPS ' } | ||
'WS' { 'WebSocket ' } | ||
'SMTP' { 'SMTP ' } | ||
'SMTPS' { 'SMTPS ' } | ||
'TCP' { 'TCP ' } | ||
'TCPS' { 'TCPS ' } | ||
default { 'UNKNOWN ' } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary, as every endpoint printed is already prepended with the protocol? https://
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s looking good 😀
Not everything in vscode. Multiple instances on different platforms but always in vscode. |
I simplified the console flow removing the cancellation token part. new Resolve-PodeCancellationToken to deal with that and changed the main core loop
Description
This pull request introduces the Suspend and Resume functionality for Pode, enabling the server to temporarily pause and later resume all activities without requiring a full restart. It also enhances the server's console output and interactivity, providing a more robust and user-friendly experience. Furthermore, server configurations (
server.psd1
) now support advanced console settings and control over allowed actions. New parameters have been added to theStart-PodeServer
function, including-IgnoreServerPsConfig
, enabling users to bypass loading configuration data fromserver.psd1
.Additionally, this pull request introduces the Disable-PodeServer and Enable-PodeServer functions, allowing for granular control over the server’s ability to accept incoming requests without impacting its overall state.
Key Features
Suspend-PodeServer:
Suspend
event and updates the server status.-Timeout
parameter to specify the maximum wait time for runspaces to suspend.Resume-PodeServer:
Resume
event, clears the server's suspended status, and updates the console view.Disable-PodeServer:
503 Service Unavailable
status.Retry-After
header, specifying the time (in seconds) clients should wait before retrying. The default value is 3600 seconds (1 hour).Enable-PodeServer:
Improved Console Output:
Endpoint and Schedule Initialization:
New Console Settings in
server.psd1
:Allowed Actions Settings:
server.psd1
to control server behaviors, including timeouts for suspend and resume operations:New Console Settings for
Start-PodeServer
:-DisableConsoleInput
: Disables keyboard interaction.-ClearHost
: Clears the console screen whenever the server changes state (e.g., running → suspend → resume).-HideOpenAPI
: Hides OpenAPI details in the console output.-HideEndpoints
: Hides the endpoint list in the console output.-ShowHelp
: Displays control commands in the console.-IgnoreServerConfig
: Ignores theserver.psd1
configuration file when starting the server. This ensures that no settings defined in the server.psd1 file are loaded, allowing for manual runtime configuration.-ConfigFile
: Specifies a custom configuration file instead of using the defaultserver.psd1
.-Daemon
: Configures the server to run as a daemon with minimal console interaction and output.Use Cases
Disable-PodeServer
to block new incoming requests during high traffic and re-enable usingEnable-PodeServer
.server.psd1
to define allowed actions and timeouts for suspend/resume transitions.Example Usage
Console Control Commands
Notes
Suspend
andResume
provide hooks for additional custom behavior during these transitions.Disable-PodeServer
andEnable-PodeServer
functions offer a lightweight alternative to suspend/resume by controlling only incoming requests, leaving the server's internal state intact.