Skip to content

Commit

Permalink
Reduce wait time
Browse files Browse the repository at this point in the history
  • Loading branch information
newtoallofthis123 committed Aug 25, 2024
1 parent 456f6b7 commit 6362748
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions swhkd/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct Args {
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let args = Args::parse();
let default_cooldown: u64 = 5;
let default_cooldown: u64 = 650;
env::set_var("RUST_LOG", "swhkd=warn");

if args.debug {
Expand Down Expand Up @@ -125,7 +125,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
// The server cool down is set to 650ms by default
// which is calculated based on the default repeat cooldown
// along with it, an additional 120ms is added to it, just to be safe.
let server_cooldown = args.refresh.unwrap_or(default_cooldown);
let server_cooldown = args.refresh.unwrap_or(default_cooldown + 1024);

let (tx, mut rx) = tokio::sync::mpsc::channel::<String>(100);
let pairs = Arc::new(Mutex::new(env.pairs.clone()));
Expand All @@ -139,7 +139,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let mut pairs = pairs_clone.lock().unwrap();
pairs.clone_from(&refresh_env(&uname, invoking_uid, false).unwrap().pairs);
}
sleep(Duration::from_secs(server_cooldown)).await;
sleep(Duration::from_millis(server_cooldown)).await;
}
});

Expand Down
2 changes: 1 addition & 1 deletion swhks/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn main() -> std::io::Result<()> {
if let Ok(mut stream) = UnixStream::connect(&sock_file_path) {
let _ = stream.write_all(env_raw.as_bytes());
};
std::thread::sleep(std::time::Duration::from_secs(3));
std::thread::sleep(std::time::Duration::from_millis(512));
}
}

Expand Down

0 comments on commit 6362748

Please sign in to comment.