Skip to content

Implement graceful stopping of app #423

Open

Description

@joseferben

Goal

When pressing Ctrl-C when the Sihl app is running, graceful stop should happen.

Todo

  1. store ref to current app and start ctx
  2. loop forever (in Lwt_main.run)
  3. when command finishes, exit loop
  4. when SIGINT comes, exit loop
  5. call stop app
let stop app ctx = 
  let* () = app.before_stop ctx in
  print_endline "CORE: Stop services"; 
  let* () = Core_container.stop_services ctx app.services in 
  print_endline "CORE: Services stopped"; 
   app.after_stop ctx 

Activity

  1. added
    enhancement
    on Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions