Skip to content

Commit 4aeee85

Browse files
authored
feat(core): improve progress plugin for multi compiler (#8301)
* feat(core): improve progress plugin for multi compiler * chore: fix clippy * chore: use lazylock * chore: fix clippy
1 parent f91522c commit 4aeee85

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rspack_plugin_progress/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::cmp::Ordering;
22
use std::sync::atomic::Ordering::Relaxed;
3-
use std::sync::{Arc, RwLock};
3+
use std::sync::{Arc, LazyLock, RwLock};
44
use std::time::{Duration, SystemTime, UNIX_EPOCH};
55
use std::{cmp, sync::atomic::AtomicU32, time::Instant};
66

77
use async_trait::async_trait;
8-
use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle};
8+
use indicatif::{MultiProgress, ProgressBar, ProgressDrawTarget, ProgressStyle};
99
use rspack_collections::IdentifierMap;
1010
use rspack_core::{
1111
ApplyContext, BoxModule, Compilation, CompilationAfterOptimizeModules,
@@ -41,6 +41,7 @@ impl std::fmt::Debug for ProgressPluginOptions {
4141
}
4242
}
4343

44+
static MULTI_PROGRESS: LazyLock<MultiProgress> = LazyLock::new(MultiProgress::new);
4445
#[derive(Debug, Default)]
4546
pub struct ProgressPluginDisplayOptions {
4647
// the prefix name of progress bar
@@ -101,7 +102,7 @@ impl ProgressPlugin {
101102
Some(progress_bar)
102103
}
103104
};
104-
105+
let progress_bar = progress_bar.map(|x| MULTI_PROGRESS.add(x));
105106
Self::new_inner(
106107
options,
107108
progress_bar,

0 commit comments

Comments
 (0)