Skip to content
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

Graceful server stopping #10458

Merged
merged 2 commits into from
May 17, 2023
Merged

Graceful server stopping #10458

merged 2 commits into from
May 17, 2023

Conversation

akx
Copy link
Collaborator

@akx akx commented May 17, 2023

Describe what this pull request is trying to achieve.

This is a part of #10291 (test overhaul).

The point is to be able to gracefully shut down the server (e.g. to be able to save code coverage information, for testing).

Additional notes and description of your changes

  • the need_restart mechanism is changed to server_command (with "stop" and "restart" being valid values)
  • there's a new state.request_restart() API for setting this, which deduplicates a couple copy-pasted segments
  • instead of having the webui() poll for need_restart every 0.5 seconds, there's a new wait_for_server_command() API
  • finally, there's a new option to add a _stop route that will cause server_command to be set to "stop". This is so that the CI process can start the server in the background and then ask it to quit when tests are finished.
    • This could be changed to a signal such as SIGUSR1 too, if the option and HTTP route is too much.
    • I figured an option would be better than just always enabling a remote way to make the server die.

Environment this was tested in

  • OS: Windows, macOS
  • Browser: Chrome
  • Graphics card: Irrelevant

@akx akx marked this pull request as ready for review May 17, 2023 07:21
@akx akx requested a review from AUTOMATIC1111 as a code owner May 17, 2023 07:21
@AUTOMATIC1111 AUTOMATIC1111 merged commit f6c06e3 into AUTOMATIC1111:dev May 17, 2023
@akx akx deleted the graceful-stop branch May 30, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants