stop method
Future<void>
stop(
- DbName dbName, {
- bool shouldIncludeStarting = true,
})
inherited
Implementation
@override
Future<void> stop(DbName dbName, {bool shouldIncludeStarting = true}) async {
// If in the process of starting, wait for it to start and then stop it.
if (shouldIncludeStarting) {
final starting = startingPromises[dbName];
if (starting != null) {
return starting.then((_satellite) => stop(dbName));
}
}
// If already stopping then return that promise.
final stopping = stoppingPromises[dbName];
if (stopping != null) {
return stopping;
}
// Otherwise, if running then stop.
final satellite = satellites[dbName];
if (satellite != null) {
final stoppingPromise = satellite.stop(shutdown: true).then((_) {
satellites.remove(dbName);
stoppingPromises.remove(dbName);
});
stoppingPromises[dbName] = stoppingPromise;
return stoppingPromise;
}
}