Skip to content

Commit

Permalink
Remove auto refresh service
Browse files Browse the repository at this point in the history
Ref: #10
  • Loading branch information
sayanarijit committed Jun 21, 2021
1 parent 5c6fd1e commit c9556d0
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xplr"
version = "0.14.2" # Update lua.rs
version = "0.14.3" # Update lua.rs
authors = ["Arijit Basu <[email protected]>"]
edition = "2018"
description = "A hackable, minimal, fast TUI file explorer"
Expand Down
12 changes: 0 additions & 12 deletions src/auto_refresher.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![allow(clippy::unnecessary_wraps)]

pub mod app;
pub mod auto_refresher;
pub mod config;
pub mod event_reader;
pub mod explorer;
Expand Down
12 changes: 6 additions & 6 deletions src/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,23 @@ mod test {
assert!(check_version(VERSION, "foo path").is_ok());

// Current release if OK
assert!(check_version("0.14.2", "foo path").is_ok());
assert!(check_version("0.14.3", "foo path").is_ok());

// Prev major release is ERR

// Prev minor release is ERR (Change when we get to v1)
assert!(check_version("0.13.2", "foo path").is_err());
assert!(check_version("0.13.3", "foo path").is_err());

// Prev bugfix release is OK
assert!(check_version("0.14.1", "foo path").is_ok());
assert!(check_version("0.14.2", "foo path").is_ok());

// Next major release is ERR
assert!(check_version("1.14.2", "foo path").is_err());
assert!(check_version("1.14.3", "foo path").is_err());

// Next minor release is ERR
assert!(check_version("0.15.2", "foo path").is_err());
assert!(check_version("0.15.3", "foo path").is_err());

// Next bugfix release is ERR (Change when we get to v1)
assert!(check_version("0.14.3", "foo path").is_err());
assert!(check_version("0.14.4", "foo path").is_err());
}
}
59 changes: 0 additions & 59 deletions src/pipe_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,62 +24,3 @@ pub fn read_all(pipe: &str) -> Result<Vec<ExternalMsg>> {
Ok(vec![])
}
}

// pub fn keep_reading(pipe: String, tx: Sender<Task>) {
// let mut last_modified = None;
// thread::spawn(move || loop {
// let path = PathBuf::from(&pipe);

// if !path.exists() {
// thread::sleep(Duration::from_millis(50));
// continue;
// }

// let modified = path.metadata().and_then(|m| m.modified()).ok();

// if modified == last_modified {
// thread::sleep(Duration::from_millis(50));
// } else if let Ok(mut file) = fs::OpenOptions::new()
// .read(true)
// .write(true)
// .create(false)
// .open(&pipe)
// {
// let mut in_str = String::new();
// file.read_to_string(&mut in_str).unwrap_or_default();
// file.set_len(0).unwrap_or_default();

// if !in_str.is_empty() {
// let msgs = in_str
// .lines()
// .map(|s| serde_yaml::from_str::<ExternalMsg>(s.trim()));

// msgs.for_each(|msg| match msg {
// Ok(m) => {
// tx.send(Task::new(MsgIn::External(m), None))
// .unwrap_or_default();
// }
// Err(e) => {
// tx.send(Task::new(
// MsgIn::External(ExternalMsg::LogError(e.to_string())),
// None,
// ))
// .unwrap_or_default();
// }
// });
// };
// } else {
// tx.send(Task::new(
// MsgIn::External(ExternalMsg::LogError(format!(
// "Failed to open input pipe: {}",
// &pipe
// ))),
// None,
// ))
// .unwrap_or_default();
// thread::sleep(Duration::from_secs(3));
// }

// last_modified = modified;
// });
// }
3 changes: 0 additions & 3 deletions src/runner.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(clippy::too_many_arguments)]

use crate::app;
use crate::auto_refresher;
use crate::event_reader;
use crate::explorer;
use crate::lua;
Expand Down Expand Up @@ -184,10 +183,8 @@ impl Runner {
terminal.hide_cursor()?;

// Threads
auto_refresher::start_auto_refreshing(tx_msg_in.clone());
event_reader::keep_reading(tx_msg_in.clone(), rx_event_reader);
pwd_watcher::keep_watching(app.pwd(), tx_msg_in.clone(), rx_pwd_watcher)?;
// pipe_reader::keep_reading(app.pipe().msg_in().clone(), tx_msg_in.clone());

// Enqueue on_load messages
for msg in self.on_load {
Expand Down

0 comments on commit c9556d0

Please sign in to comment.