feat: simplify shutdown (#1502)

* feat: simplify shutdown

* chore: fix lint

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/24376/head
Raphael Taylor-Davies 2021-05-17 12:50:14 +01:00 committed by GitHub
parent 07db4932ee
commit 91a45fd380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 17 deletions

View File

@ -91,8 +91,6 @@ use object_store::{path::ObjectStorePath, ObjectStore, ObjectStoreApi};
use query::{exec::Executor, DatabaseStore};
use tracker::{TaskId, TaskRegistration, TaskRegistryWithHistory, TaskTracker, TrackedFutureExt};
use futures::{pin_mut, FutureExt};
use crate::{
config::{
object_store_path_for_database_config, Config, GRpcConnectionString, DB_RULES_FILE_NAME,
@ -801,21 +799,8 @@ impl<M: ConnectionManager> Server<M> {
}
}
info!("shutting down background worker");
let join = self.config.drain().fuse();
pin_mut!(join);
// Keep running reclaim whilst shutting down in case something
// is waiting on a tracker to complete
loop {
self.jobs.inner.lock().reclaim();
futures::select! {
_ = interval.tick().fuse() => {},
_ = join => break
}
}
info!("shutting down background workers");
self.config.drain().await;
info!("draining tracker registry");