mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: continuous fetcher was not scheduled consecutively (#1575)
This commit is contained in:
parent
a0a2331b3b
commit
907ac09e34
6 changed files with 18 additions and 11 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -1138,9 +1138,9 @@ checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126"
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c"
|
||||
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
|
|
@ -2516,9 +2516,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.39.3"
|
||||
version = "1.40.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5"
|
||||
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ scopeguard = "1.2.0"
|
|||
serde = { version = "1.0.209", features = [ "derive" ] }
|
||||
serde_json = "1.0.127"
|
||||
shell-words = "1.1.0"
|
||||
tokio = { version = "1.39.3", features = [ "full" ] }
|
||||
tokio = { version = "1.40.0", features = [ "full" ] }
|
||||
tokio-stream = "0.1.15"
|
||||
tokio-util = "0.7.11"
|
||||
tracing = { version = "0.1.40", features = [ "max_level_debug", "release_max_level_warn" ] }
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ arc-swap = { workspace = true }
|
|||
bitflags = { workspace = true }
|
||||
crossterm = { workspace = true }
|
||||
globset = { workspace = true }
|
||||
indexmap = { version = "2.4.0", features = [ "serde" ] }
|
||||
indexmap = { version = "2.5.0", features = [ "serde" ] }
|
||||
ratatui = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ impl Plugin {
|
|||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn fetchers_mask(&self) -> u32 {
|
||||
self.fetchers.iter().fold(0, |n, f| if f.mime.is_some() { n } else { n | 1 << f.idx as u32 })
|
||||
}
|
||||
|
||||
pub fn preloaders<'a>(
|
||||
&'a self,
|
||||
path: &'a Path,
|
||||
|
|
@ -48,6 +53,7 @@ impl Plugin {
|
|||
self.previewers.iter().find(|&p| p.matches(path, mime))
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Plugin {
|
||||
type Err = toml::de::Error;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,11 @@ impl Tasks {
|
|||
}
|
||||
|
||||
pub fn prework_affected(&self, affected: &[File], mimetype: &HashMap<Url, String>) {
|
||||
let mask = PLUGIN.fetchers_mask();
|
||||
{
|
||||
let mut loaded = self.scheduler.prework.loaded.lock();
|
||||
for f in affected {
|
||||
loaded.remove(&f.url);
|
||||
loaded.get_mut(&f.url).map(|n| *n &= mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ impl Prework {
|
|||
urls.iter().map(ToString::to_string).collect::<Vec<_>>().join("\n")
|
||||
);
|
||||
}
|
||||
if code >> 1 & 1 != 0 {
|
||||
if code & 2 != 0 {
|
||||
let mut loaded = self.loaded.lock();
|
||||
for url in urls {
|
||||
loaded.get_mut(&url).map(|x| *x ^= 1 << task.plugin.id);
|
||||
loaded.get_mut(&url).map(|x| *x &= !(1 << task.plugin.id));
|
||||
}
|
||||
}
|
||||
self.prog.send(TaskProg::Adv(task.id, 1, 0))?;
|
||||
|
|
@ -75,9 +75,9 @@ impl Prework {
|
|||
if code & 1 == 0 {
|
||||
error!("Returned {code} when running preloader `{}` with `{url}`", task.plugin.name);
|
||||
}
|
||||
if code >> 1 & 1 != 0 {
|
||||
if code & 2 != 0 {
|
||||
let mut loaded = self.loaded.lock();
|
||||
loaded.get_mut(&url).map(|x| *x ^= 1 << task.plugin.id);
|
||||
loaded.get_mut(&url).map(|x| *x &= !(1 << task.plugin.id));
|
||||
}
|
||||
self.prog.send(TaskProg::Adv(task.id, 1, 0))?;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue