Repository: tikv/tikv
File: components/raftstore/src/store/fsm/store.rs (Rust)

Code before:
        let snap_gen_scheduler: Scheduler<SnapGenTask<<EK as KvEngine>::Snapshot>> = workers
            .snap_gen_worker
            .start("snap-generator", snap_gen_runner);
        let region_scheduler = workers
            .region_worker
            .start_with_timer("region-worker", region_runner);
        // Same as split_check_scheduler, region worker also runs a infinite
        // loop, that will not stop when shutting down the threadpool, causing the
        // reference to the kv engine inside the scheduler to be dangle. So we need
        // to stop the scheduler before shutting down the threadpool.
        let region_scheduler_clone = region_scheduler.clone();
        workers.on_stop_hooks.push(Box::new(move || {
            region_scheduler_clone.stop();
        }));
        let raftlog_gc_runner = RaftlogGcRunner::new(
            engines.clone(),
            cfg.value().raft_log_compact_sync_interval.0,
        );
        let raftlog_gc_scheduler = workers
            .background_worker
            .start_with_timer("raft-gc-worker", raftlog_gc_runner);
        // Same as split_check_scheduler, raftlog_gc_scheduler also runs a infinite
        // loop, that will not stop when shutting down the threadpool, causing the
        // reference to the raft engine inside the scheduler to be dangle. So we need
        // to stop the scheduler before shutting down the threadpool.
        let reftlog_gc_scheduler_clone = raftlog_gc_scheduler.clone();
        workers.on_stop_hooks.push(Box::new(move || {
            reftlog_gc_scheduler_clone.stop();
        }));

        let raftlog_fetch_scheduler = workers.raftlog_fetch_worker.start(
            "raftlog-fetch-worker",
            ReadRunner::new(self.router.clone(), engines.raft.clone()),
        );

        let compact_runner = CompactRunner::new(
            engines.kv.clone(),
            bgworker_remote,
            cfg.clone().tracker(String::from("compact-runner")),
            cfg.value().skip_manual_compaction_in_clean_up_worker,
        );
        let cleanup_sst_runner = CleanupSstRunner::new(Arc::clone(&importer));
        let gc_snapshot_runner = GcSnapshotRunner::new(
            meta.get_id(),
            self.router.clone(), // RaftRouter
            mgr.clone(),
        );
        let cleanup_runner =
            CleanupRunner::new(compact_runner, cleanup_sst_runner, gc_snapshot_runner);
        let cleanup_scheduler = workers
            .cleanup_worker

Review comment (suggestion):
```suggestion
        let raftlog_gc_scheduler_clone = raftlog_gc_scheduler.clone();
```

Code after:
        let snap_gen_scheduler: Scheduler<SnapGenTask<<EK as KvEngine>::Snapshot>> = workers
            .snap_gen_worker
            .start("snap-generator", snap_gen_runner);
        let region_scheduler = workers
            .region_worker
            .start_with_timer("region-worker", region_runner);
        // Same as split_check_scheduler, region worker also runs a infinite
        // loop, that will not stop when shutting down the threadpool, causing the
        // reference to the kv engine inside the scheduler to be dangle. So we need
        // to stop the scheduler before shutting down the threadpool.
        let region_scheduler_clone = region_scheduler.clone();
        workers.on_stop_hooks.push(Box::new(move || {
            region_scheduler_clone.stop();
        }));
        let raftlog_gc_runner = RaftlogGcRunner::new(
            engines.clone(),
            cfg.value().raft_log_compact_sync_interval.0,
        );
        let raftlog_gc_scheduler = workers
            .background_worker
            .start_with_timer("raft-gc-worker", raftlog_gc_runner);
        // Same as split_check_scheduler, raftlog_gc_scheduler also runs a infinite
        // loop, that will not stop when shutting down the threadpool, causing the
        // reference to the raft engine inside the scheduler to be dangle. So we need
        // to stop the scheduler before shutting down the threadpool.
        let raftlog_gc_scheduler_clone = raftlog_gc_scheduler.clone();
        workers.on_stop_hooks.push(Box::new(move || {
            raftlog_gc_scheduler_clone.stop();
        }));

        let raftlog_fetch_scheduler = workers.raftlog_fetch_worker.start(
            "raftlog-fetch-worker",
            ReadRunner::new(self.router.clone(), engines.raft.clone()),
        );

        let compact_runner = CompactRunner::new(
            engines.kv.clone(),
            bgworker_remote,
            cfg.clone().tracker(String::from("compact-runner")),
            cfg.value().skip_manual_compaction_in_clean_up_worker,
        );
        let cleanup_sst_runner = CleanupSstRunner::new(Arc::clone(&importer));
        let gc_snapshot_runner = GcSnapshotRunner::new(
            meta.get_id(),
            self.router.clone(), // RaftRouter
            mgr.clone(),
        );
        let cleanup_runner =
            CleanupRunner::new(compact_runner, cleanup_sst_runner, gc_snapshot_runner);
        let cleanup_scheduler = workers
            .cleanup_worker