mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-24 06:35:39 +00:00
Use PollWatcher in memofs StdBackend on macOS (#783)
This commit is contained in:
@@ -116,6 +116,7 @@
|
|||||||
* Add buttons for navigation on the Connected page ([#722])
|
* Add buttons for navigation on the Connected page ([#722])
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
* Significantly improved performance of `rojo serve` and `rojo build` on macOS. [#783]
|
||||||
* Significantly improved performance of `rojo sourcemap` ([#668])
|
* Significantly improved performance of `rojo sourcemap` ([#668])
|
||||||
* Fixed the diff visualizer of connected sessions. ([#674])
|
* Fixed the diff visualizer of connected sessions. ([#674])
|
||||||
* Fixed disconnected session activity. ([#675])
|
* Fixed disconnected session activity. ([#675])
|
||||||
@@ -149,6 +150,7 @@
|
|||||||
[#770]: https://github.com/rojo-rbx/rojo/pull/770
|
[#770]: https://github.com/rojo-rbx/rojo/pull/770
|
||||||
[#771]: https://github.com/rojo-rbx/rojo/pull/771
|
[#771]: https://github.com/rojo-rbx/rojo/pull/771
|
||||||
[#774]: https://github.com/rojo-rbx/rojo/pull/774
|
[#774]: https://github.com/rojo-rbx/rojo/pull/774
|
||||||
|
[#783]: https://github.com/rojo-rbx/rojo/pull/783
|
||||||
[rbx-dom#299]: https://github.com/rojo-rbx/rbx-dom/pull/299
|
[rbx-dom#299]: https://github.com/rojo-rbx/rbx-dom/pull/299
|
||||||
[rbx-dom#296]: https://github.com/rojo-rbx/rbx-dom/pull/296
|
[rbx-dom#296]: https://github.com/rojo-rbx/rbx-dom/pull/296
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# memofs Changelog
|
# memofs Changelog
|
||||||
|
|
||||||
## Unreleased Changes
|
## Unreleased Changes
|
||||||
|
* Changed the `StdBackend` file watcher to use `PollWatcher` on macOS.
|
||||||
|
|
||||||
## 0.2.0 (2021-08-23)
|
## 0.2.0 (2021-08-23)
|
||||||
* Updated to `crossbeam-channel` 0.5.1.
|
* Updated to `crossbeam-channel` 0.5.1.
|
||||||
@@ -15,4 +16,4 @@
|
|||||||
* Improved error messages using the [fs-err](https://crates.io/crates/fs-err) crate.
|
* Improved error messages using the [fs-err](https://crates.io/crates/fs-err) crate.
|
||||||
|
|
||||||
## 0.1.0 (2020-03-10)
|
## 0.1.0 (2020-03-10)
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|||||||
@@ -5,19 +5,34 @@ use std::thread;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use crossbeam_channel::Receiver;
|
use crossbeam_channel::Receiver;
|
||||||
use notify::{watcher, DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
|
use notify::{DebouncedEvent, RecursiveMode, Watcher};
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
use notify::PollWatcher;
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
use notify::{watcher, RecommendedWatcher};
|
||||||
|
|
||||||
use crate::{DirEntry, Metadata, ReadDir, VfsBackend, VfsEvent};
|
use crate::{DirEntry, Metadata, ReadDir, VfsBackend, VfsEvent};
|
||||||
|
|
||||||
/// `VfsBackend` that uses `std::fs` and the `notify` crate.
|
/// `VfsBackend` that uses `std::fs` and the `notify` crate.
|
||||||
pub struct StdBackend {
|
pub struct StdBackend {
|
||||||
|
// We use PollWatcher on macos because using the KQueue watcher
|
||||||
|
// can cause some gnarly performance problems.
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
watcher: PollWatcher,
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
watcher: RecommendedWatcher,
|
watcher: RecommendedWatcher,
|
||||||
|
|
||||||
watcher_receiver: Receiver<VfsEvent>,
|
watcher_receiver: Receiver<VfsEvent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StdBackend {
|
impl StdBackend {
|
||||||
pub fn new() -> StdBackend {
|
pub fn new() -> StdBackend {
|
||||||
let (notify_tx, notify_rx) = mpsc::channel();
|
let (notify_tx, notify_rx) = mpsc::channel();
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
let watcher = PollWatcher::new(notify_tx, Duration::from_millis(50)).unwrap();
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
let watcher = watcher(notify_tx, Duration::from_millis(50)).unwrap();
|
let watcher = watcher(notify_tx, Duration::from_millis(50)).unwrap();
|
||||||
|
|
||||||
let (tx, rx) = crossbeam_channel::unbounded();
|
let (tx, rx) = crossbeam_channel::unbounded();
|
||||||
|
|||||||
Reference in New Issue
Block a user