mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor path suppression handling in ChangeProcessor and ApiService
- Updated the `suppressed_paths` structure in `ChangeProcessor` and `ApiService` to store counts for both remove and create/write events, enhancing the accuracy of event suppression. - Refactored methods for suppressing and unsuppressing paths to accommodate the new structure, ensuring that the system correctly manages VFS events based on the type of operation. - Improved documentation and comments to clarify the purpose and behavior of the suppression logic, contributing to better maintainability and understanding of the code.
This commit is contained in:
parent
2336671292
commit
67537070db
6 changed files with 137 additions and 95 deletions
|
|
@ -89,9 +89,10 @@ pub struct ServeSession {
|
|||
/// Paths recently written by the API's syncback. The ChangeProcessor
|
||||
/// checks this map and suppresses the file watcher echo for these paths
|
||||
/// to avoid redundant re-snapshots and WebSocket messages.
|
||||
/// Values are counts — each API write increments, each suppressed VFS event decrements.
|
||||
/// Values are `(remove_count, create_write_count)` — each API write increments
|
||||
/// the appropriate counter, each suppressed VFS event decrements it.
|
||||
#[allow(dead_code)]
|
||||
suppressed_paths: Arc<Mutex<std::collections::HashMap<std::path::PathBuf, usize>>>,
|
||||
suppressed_paths: Arc<Mutex<std::collections::HashMap<std::path::PathBuf, (usize, usize)>>>,
|
||||
}
|
||||
|
||||
impl ServeSession {
|
||||
|
|
@ -180,7 +181,7 @@ impl ServeSession {
|
|||
#[allow(dead_code)]
|
||||
pub fn suppressed_paths(
|
||||
&self,
|
||||
) -> Arc<Mutex<std::collections::HashMap<std::path::PathBuf, usize>>> {
|
||||
) -> Arc<Mutex<std::collections::HashMap<std::path::PathBuf, (usize, usize)>>> {
|
||||
Arc::clone(&self.suppressed_paths)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue