-
Notifications
You must be signed in to change notification settings - Fork 255
Added wait_to_build time to config #391
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,9 +105,6 @@ pub enum BuildPriority { | |
Normal, | ||
} | ||
|
||
// Minimum time to wait before starting a `BuildPriority::Normal` build. | ||
const WAIT_TO_BUILD: u64 = 500; | ||
|
||
#[derive(Clone, Copy, Debug, Eq, PartialEq)] | ||
enum Signal { | ||
Build, | ||
|
@@ -166,7 +163,12 @@ impl BuildQueue { | |
let (tx, rx) = channel(); | ||
self.pending.lock().unwrap().push(tx); | ||
if priority == BuildPriority::Normal { | ||
thread::sleep(Duration::from_millis(WAIT_TO_BUILD)); | ||
let wait_to_build = { // Release lock before we sleep | ||
let config = self.config.lock().unwrap(); | ||
config.wait_to_build | ||
}; | ||
|
||
thread::sleep(Duration::from_millis(wait_to_build as u64)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could make the config option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. I need to add a new impl for ConfigType for that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that sounds good |
||
} | ||
|
||
if self.running.load(Ordering::SeqCst) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,6 +157,7 @@ create_config! { | |
build_bin: String, String::new(), false, "cargo check --bin <name>"; | ||
cfg_test: bool, true, false, "build cfg(test) code"; | ||
unstable_features: bool, false, false, "enable unstable features"; | ||
wait_to_build: usize, 500, false, "time between receiving a change notification and starting build"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add "in milliseconds" to the description please? |
||
} | ||
|
||
/// A rustfmt config (typically specified via rustfmt.toml) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!