Skip to content

Commit

Permalink
Revert "Use PollWatcher in memofs StdBackend on macOS (rojo-rbx#783)"
Browse files Browse the repository at this point in the history
This reverts commit 3cafbf7.
  • Loading branch information
kennethloeffler committed Jan 1, 2024
1 parent 45e4ec9 commit e0cad68
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
* Add buttons for navigation on the Connected page ([#722])

### Fixes
* Significantly improved performance of `rojo serve` and `rojo build` on macOS. [#783]
* Significantly improved performance of `rojo sourcemap` ([#668])
* Fixed the diff visualizer of connected sessions. ([#674])
* Fixed disconnected session activity. ([#675])
Expand Down Expand Up @@ -172,7 +171,6 @@
[#770]: https://github.com/rojo-rbx/rojo/pull/770
[#771]: https://github.com/rojo-rbx/rojo/pull/771
[#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#296]: https://github.com/rojo-rbx/rbx-dom/pull/296

Expand Down
3 changes: 1 addition & 2 deletions crates/memofs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# memofs Changelog

## Unreleased Changes
* Changed the `StdBackend` file watcher to use `PollWatcher` on macOS.

## 0.2.0 (2021-08-23)
* Updated to `crossbeam-channel` 0.5.1.
Expand All @@ -16,4 +15,4 @@
* Improved error messages using the [fs-err](https://crates.io/crates/fs-err) crate.

## 0.1.0 (2020-03-10)
* Initial release
* Initial release
17 changes: 1 addition & 16 deletions crates/memofs/src/std_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,19 @@ use std::thread;
use std::time::Duration;

use crossbeam_channel::Receiver;
use notify::{DebouncedEvent, RecursiveMode, Watcher};

#[cfg(target_os = "macos")]
use notify::PollWatcher;
#[cfg(not(target_os = "macos"))]
use notify::{watcher, RecommendedWatcher};
use notify::{watcher, DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};

use crate::{DirEntry, Metadata, ReadDir, VfsBackend, VfsEvent};

/// `VfsBackend` that uses `std::fs` and the `notify` crate.
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_receiver: Receiver<VfsEvent>,
}

impl StdBackend {
pub fn new() -> StdBackend {
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 (tx, rx) = crossbeam_channel::unbounded();
Expand Down

0 comments on commit e0cad68

Please sign in to comment.