mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
perf: reduce file change event frequency (#2820)
This commit is contained in:
parent
b65a88075a
commit
d5038eeed5
5 changed files with 2 additions and 44 deletions
|
|
@ -122,7 +122,7 @@ impl Watcher {
|
|||
|
||||
async fn fan_out(rx: UnboundedReceiver<Url>) {
|
||||
// TODO: revert this once a new notification is implemented
|
||||
let rx = UnboundedReceiverStream::new(rx).chunks_timeout(1000, Duration::from_millis(100));
|
||||
let rx = UnboundedReceiverStream::new(rx).chunks_timeout(1000, Duration::from_millis(350));
|
||||
pin!(rx);
|
||||
|
||||
while let Some(chunk) = rx.next().await {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local M = {}
|
||||
|
||||
function M:peek() end
|
||||
function M:peek(job) ya.preview_widget(job, {}) end
|
||||
|
||||
function M:seek() end
|
||||
|
||||
|
|
|
|||
|
|
@ -152,21 +152,6 @@ impl UserData for Command {
|
|||
}
|
||||
Ok(ud)
|
||||
});
|
||||
// TODO: remove this
|
||||
methods.add_function_mut("args", |lua, (ud, args): (AnyUserData, Vec<mlua::String>)| {
|
||||
crate::deprecate!(
|
||||
lua,
|
||||
"The `args()` method on `Command` is deprecated, use `arg()` instead in your {}\n\nSee #2752 for more details: https://github.com/sxyazi/yazi/pull/2752"
|
||||
);
|
||||
|
||||
{
|
||||
let mut me = ud.borrow_mut::<Self>()?;
|
||||
for arg in args {
|
||||
me.inner.arg(arg.to_string_lossy());
|
||||
}
|
||||
}
|
||||
Ok(ud)
|
||||
});
|
||||
methods.add_function_mut("cwd", |_, (ud, dir): (AnyUserData, mlua::String)| {
|
||||
ud.borrow_mut::<Self>()?.inner.current_dir(dir.to_str()?.as_ref());
|
||||
Ok(ud)
|
||||
|
|
|
|||
|
|
@ -21,34 +21,10 @@ impl Utils {
|
|||
})
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
pub(super) fn app_emit(lua: &Lua) -> mlua::Result<Function> {
|
||||
lua.create_function(|lua, (name, args): (String, Table)| {
|
||||
crate::deprecate!(
|
||||
lua,
|
||||
"`ya.app_emit()` is deprecated, use `ya.emit()` instead, in your {}\n\nSee #2653 for more details: https://github.com/sxyazi/yazi/pull/2653"
|
||||
);
|
||||
emit!(Call(Cmd { name, args: Sendable::table_to_args(args)?, layer: Layer::App }));
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn mgr_emit(lua: &Lua) -> mlua::Result<Function> {
|
||||
lua.create_function(|_, (name, args): (String, Table)| {
|
||||
emit!(Call(Cmd { name, args: Sendable::table_to_args(args)?, layer: Layer::Mgr }));
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
pub(super) fn input_emit(lua: &Lua) -> mlua::Result<Function> {
|
||||
lua.create_function(|lua, (name, args): (String, Table)| {
|
||||
crate::deprecate!(
|
||||
lua,
|
||||
"`ya.input_emit()` is deprecated, use `ya.emit()` instead, in your {}\n\nSee #2653 for more details: https://github.com/sxyazi/yazi/pull/2653"
|
||||
);
|
||||
emit!(Call(Cmd { name, args: Sendable::table_to_args(args)?, layer: Layer::Input }));
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,8 @@ pub fn compose(lua: &Lua, isolate: bool) -> mlua::Result<Value> {
|
|||
// Call
|
||||
b"render" => Utils::render(lua)?,
|
||||
b"emit" => Utils::emit(lua)?,
|
||||
b"app_emit" => Utils::app_emit(lua)?,
|
||||
b"mgr_emit" => Utils::mgr_emit(lua)?,
|
||||
b"manager_emit" => Utils::mgr_emit(lua)?, // TODO: remove this in the future
|
||||
b"input_emit" => Utils::input_emit(lua)?,
|
||||
|
||||
// Image
|
||||
b"image_info" => Utils::image_info(lua)?,
|
||||
|
|
@ -44,7 +42,6 @@ pub fn compose(lua: &Lua, isolate: bool) -> mlua::Result<Value> {
|
|||
// Preview
|
||||
b"preview_code" => Utils::preview_code(lua)?,
|
||||
b"preview_widget" => Utils::preview_widget(lua)?,
|
||||
b"preview_widgets" => Utils::preview_widget(lua)?, // TODO: remove this in the future
|
||||
|
||||
// Process
|
||||
b"proc_info" => Utils::proc_info(lua)?,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue