dora-rs / dora

DORA (Dataflow-Oriented Robotic Application) is middleware designed to streamline and simplify the creation of AI-based robotic applications. It offers low latency, composable, and distributed dataflow capabilities. Applications are modeled as directed graphs, also referred to as pipelines.
https://dora-rs.ai
Apache License 2.0
1.34k stars 65 forks source link

Hot reload does not work with complex configuration vim #530

Open hbuxiaofei opened 3 weeks ago

hbuxiaofei commented 3 weeks ago

Env:

When editing a source file using the vim editor, the following events will occur:

>>> recv an event: Ok(Event { kind: Modify(Name(From)), paths: ["/home/rayylee/github/code-test/rust/dora-test/python-operator-dataflow/plot.py"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None })
>>> recv an event: Ok(Event { kind: Modify(Metadata(Any)), paths: ["/home/rayylee/github/code-test/rust/dora-test/python-operator-dataflow/plot.py"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None })
>>> recv an event: Ok(Event { kind: Remove(File), paths: ["/home/rayylee/github/code-test/rust/dora-test/python-operator-dataflow/plot.py"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None })

The ModifyKind::Data event will not occur.

phil-opp commented 3 weeks ago

Thanks for reporting!

Apparently vim is replacing the file with a new one when saving it, instead of modifying it. See https://github.com/notify-rs/notify/issues/247 and https://github.com/notify-rs/notify/issues/113. So it looks like we have to watch the directory instead.

phil-opp commented 3 weeks ago

I opened a PR to hopefully fix this issue: https://github.com/dora-rs/dora/pull/532. Could you please try whether it works for you? Thanks!