aboutsummaryrefslogtreecommitdiff
path: root/src/table/gc.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-14 12:28:07 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-14 12:28:07 +0100
commit2183518edccadef47cdeaf6476033b52d8832d6e (patch)
tree8a7d0ce0a622bd512ad6138a90f4bb4604bc38fb /src/table/gc.rs
parent83c8467e23c1f531ae233766d5dc7244afe57f08 (diff)
downloadgarage-2183518edccadef47cdeaf6476033b52d8832d6e.tar.gz
garage-2183518edccadef47cdeaf6476033b52d8832d6e.zip
Spawn all background workers in a separate step
Diffstat (limited to 'src/table/gc.rs')
-rw-r--r--src/table/gc.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/table/gc.rs b/src/table/gc.rs
index cfdc9d2d..c83c2050 100644
--- a/src/table/gc.rs
+++ b/src/table/gc.rs
@@ -54,24 +54,27 @@ where
F: TableSchema + 'static,
R: TableReplication + 'static,
{
- pub(crate) fn launch(system: Arc<System>, data: Arc<TableData<F, R>>) -> Arc<Self> {
+ pub(crate) fn new(system: Arc<System>, data: Arc<TableData<F, R>>) -> Arc<Self> {
let endpoint = system
.netapp
.endpoint(format!("garage_table/gc.rs/Rpc:{}", F::TABLE_NAME));
let gc = Arc::new(Self {
- system: system.clone(),
+ system,
data,
endpoint,
});
-
gc.endpoint.set_handler(gc.clone());
- system.background.spawn_worker(GcWorker::new(gc.clone()));
-
gc
}
+ pub(crate) fn spawn_workers(self: &Arc<Self>) {
+ self.system
+ .background
+ .spawn_worker(GcWorker::new(self.clone()));
+ }
+
async fn gc_loop_iter(&self) -> Result<Option<Duration>, Error> {
let now = now_msec();