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

Adds Gracefully Server Stop #23

Open
rafaeldelboni opened this issue Jul 24, 2021 · 2 comments
Open

Adds Gracefully Server Stop #23

rafaeldelboni opened this issue Jul 24, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rafaeldelboni
Copy link
Member

rafaeldelboni commented Jul 24, 2021

Adds graceful stop

(defn -main
  "The entry-point for 'gen-class'"
  [& _args]
  (start-system! (build-system-map))
  ; Graceful shutdown
  (.addShutdownHook (Runtime/getRuntime)
                    (Thread. ^Runnable stop-system!)))

CC @lucascebertin

@rafaeldelboni rafaeldelboni added enhancement New feature or request good first issue Good for newcomers labels Jul 24, 2021
@rafaeldelboni
Copy link
Member Author

@lucascebertin
Copy link

lucascebertin commented Jul 25, 2021

The event addShutdownHook needs to be placed before (start-system! (build-system-map)).
Without this small fix, signaling are not handled properly because of the control flow blocked by the webserver.

(defn -main
  "The entry-point for 'gen-class'"
  [& _args]
  ; Graceful shutdown
  (.addShutdownHook (Runtime/getRuntime) (Thread. ^Runnable stop-system!))
  (start-system! (build-system-map)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants