View source on GitHub |
Registers a function to be called when the server is shutting down.
google.appengine.api.runtime.set_shutdown_hook(
hook
)
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.