The shutdown hook will be called when the server shuts down. Your code
will have a short amount of time to save state and exit. The shutdown
hook should interrupt any long running code you have, e.g. by calling
apiproxy_stub_map.apiproxy.CancelApiCalls and/or raising an exception.
Args
hook
A no-argument callable which will be called when the server is
shutting down.
Returns
The previously registered shutdown hook, or None if no hook was
registered before.
In some cases it may not be possible to run the shutdown hook
before the server exits.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-09-30 UTC."],[[["Registers a function to be executed when the server is in the process of shutting down."],["The function, referred to as the 'shutdown hook', is designed to facilitate saving state and exiting gracefully during server shutdown."],["The provided hook function should be a callable with no arguments."],["The function will have limited execution time, and it is advised to interrupt ongoing code using techniques such as `apiproxy_stub_map.apiproxy.CancelApiCalls` or by raising an exception."],["The function returns the previously registered hook, and returns None if there was no hook registered before."]]],[]]