Skip to content

Graceful exit with an API call, or better ?  #736

@flotrek

Description

@flotrek

I'm trying to gracefully exit the webServer with a GET or POST to the the webServer itself.

Is there a way to execute code after a HTTP response has been given to the client to help me do that properly ?

Is there a nicer way to handle shutting down suave server from a CD pipeline ?

let app = 
    choose [
        path "/gracefulExit" >=> 
            request(fun r -> 
                fun () ->
                    Threading.Thread.Sleep(1000)
                    Log.Information("graceful exit...")
                    cancellationTokenSource.Cancel()                                         
                |> doAsyncTask |> Async.Start 
                OK "Initiating graceful exit"
                                       )]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions