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

Add serverWillStop lifecycle hook; call stop() on signals by default #4450

Closed
wants to merge 1 commit into from

Commits on Aug 24, 2020

  1. Add serverWillStop lifecycle hook; call stop() on signals by default

    Fixes #4273.
    
    This PR adds a serverWillStop plugin lifecycle hook.  The `serverWillStop` hook
    is on an object optionally returned from a `serverWillStart` hook, similar to
    `executionDidStart`/`executionDidEnd`.
    
    ApolloServerPluginOperationRegistry uses this to stop its agent.
    
    The code that installs SIGINT and SIGTERM handlers unless disabled with
    `handleSignals: false` is hoisted from EngineReportingAgent to ApolloServer
    itself and renamed to `stopOnTerminationSignals` as a new ApolloServer
    option. The new implementation also skips installing the signals handlers by
    default if NODE_ENV=test or if you don't appear to be running in Node (and we
    update some tests that explicitly set other NODE_ENVs to set handleSignals:
    false).
    
    The main effect on existing code is that on one of these signals, any
    SubscriptionServer and ApolloGateway will be stopped in addition to any
    EngineReportingAgent.
    glasser committed Aug 24, 2020
    Configuration menu
    Copy the full SHA
    dc5b8f5 View commit details
    Browse the repository at this point in the history