stop method
Stop the server gracefully, in every isolate:
- stop taking new connections
- wait for open requests, up to
config.shutdownTimeout - run
shutdown()of every provider (eg. close database connections) - close the cache stores (eg. Redis connections)
SIGTERM and SIGINT call this, then exit the process.
await Dox().stop();
Implementation
Future<void> stop() async {
_cancelSignals();
try {
await Future.wait(<Future<void>>[
_spawner.stopAll(config.shutdownTimeout),
stopIsolate(),
]);
// close the bus again: `killAll` closes it while the providers of the
// main isolate still shut down, and one of them may join it again.
IsolateBus.instance.close();
// last: the other isolates may use it until they are done
ComputePool.instance.close();
} finally {
LogBuffer.flush();
}
}