Skip to content

Commit 1f58f57

Browse files
committed
refactor: remove worker_handle from SerialLoadingQueue and simplify initialization
1 parent 1af6e7d commit 1f58f57

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src-tauri/src/k8s/shared_cache.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,19 @@ pub struct BackgroundLoadTask {
6363
/// Global serial loading queue to prevent thundering herd
6464
pub struct SerialLoadingQueue {
6565
sender: mpsc::UnboundedSender<BackgroundLoadTask>,
66-
worker_handle: Option<JoinHandle<()>>,
6766
}
6867

6968
static LOADING_QUEUE: Lazy<Mutex<Option<SerialLoadingQueue>>> = Lazy::new(|| Mutex::new(None));
7069

7170
impl SerialLoadingQueue {
7271
pub fn new() -> Self {
7372
let (sender, receiver) = mpsc::unbounded_channel();
74-
75-
let worker_handle = tokio::spawn(async move {
73+
74+
tokio::spawn(async move {
7675
Self::process_queue(receiver).await;
7776
});
7877

79-
Self {
80-
sender,
81-
worker_handle: Some(worker_handle),
82-
}
78+
Self { sender }
8379
}
8480

8581
pub fn enqueue(&self, task: BackgroundLoadTask) -> Result<(), String> {

0 commit comments

Comments
 (0)