fix: build error on nix
this happened because nixpkgs doens't yet have the latest nightly rust
This commit is contained in:
parent
ba0bfc7dad
commit
d0a2cc22c0
1 changed files with 22 additions and 15 deletions
37
src/main.rs
37
src/main.rs
|
@ -34,23 +34,24 @@ async fn config_reloader(notify: Arc<Notify>) {
|
|||
loop {
|
||||
trace!("config poll tick");
|
||||
let config_path = get_config_path();
|
||||
if config_path.exists()
|
||||
&& let Ok(current_modified) = std::fs::metadata(&config_path)
|
||||
if config_path.exists() {
|
||||
if let Ok(current_modified) = std::fs::metadata(&config_path)
|
||||
.and_then(|m| m.modified())
|
||||
.map(|t| t.duration_since(UNIX_EPOCH).unwrap().as_secs())
|
||||
{
|
||||
let last: u64 = LAST_MODIFIED.load(Ordering::SeqCst);
|
||||
if 0 != last {
|
||||
if current_modified > last {
|
||||
trace!("{current_modified}");
|
||||
trace!("{last}");
|
||||
debug!("Config file modified, reloading...");
|
||||
{
|
||||
let last: u64 = LAST_MODIFIED.load(Ordering::SeqCst);
|
||||
if 0 != last {
|
||||
if current_modified > last {
|
||||
trace!("{current_modified}");
|
||||
trace!("{last}");
|
||||
debug!("Config file modified, reloading...");
|
||||
reload_config(Arc::clone(¬ify)).await;
|
||||
}
|
||||
} else {
|
||||
// File is new, reload to capture initial state
|
||||
debug!("Config file detected, reloading...");
|
||||
reload_config(Arc::clone(¬ify)).await;
|
||||
}
|
||||
} else {
|
||||
// File is new, reload to capture initial state
|
||||
debug!("Config file detected, reloading...");
|
||||
reload_config(Arc::clone(¬ify)).await;
|
||||
}
|
||||
}
|
||||
sleep(Duration::from_secs(5)).await;
|
||||
|
@ -136,14 +137,20 @@ async fn socket_server(
|
|||
let now = !disabled_temp.load(Ordering::SeqCst);
|
||||
disabled_temp.store(now, Ordering::SeqCst);
|
||||
notify.notify_one();
|
||||
debug!("temp dimming is {}", if now { "enabled" } else { "disabled" });
|
||||
debug!(
|
||||
"temp dimming is {}",
|
||||
if now { "enabled" } else { "disabled" }
|
||||
);
|
||||
}
|
||||
"toggle_gamma" => {
|
||||
trace!("toggle_gamma dispatched");
|
||||
let now = !disabled_gamma.load(Ordering::SeqCst);
|
||||
disabled_gamma.store(now, Ordering::SeqCst);
|
||||
notify.notify_one();
|
||||
debug!("gamma dimming is {}", if now { "enabled" } else { "disabled" });
|
||||
debug!(
|
||||
"gamma dimming is {}",
|
||||
if now { "enabled" } else { "disabled" }
|
||||
);
|
||||
}
|
||||
"toggle" => {
|
||||
trace!("toggle dispatched");
|
||||
|
|
Loading…
Reference in a new issue