From 393013debdf6439d873e2c18403280bd9e08c5d0 Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Fri, 13 Dec 2024 21:52:11 +0100 Subject: [PATCH] fix: fixed high cpu usage in follow mode on macos (#588) * build(ci): fixed the list of pull request branches for coverage workflow * fix: fixed high cpu usage in follow mode on macos --- .github/workflows/coverage.yml | 2 +- Cargo.lock | 2 +- Cargo.toml | 2 +- src/fsmon.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ad285d9d..8d6c8f3b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -4,7 +4,7 @@ on: push: branches: [master, release/*] pull_request: - branches: ['*'] + branches: [master, release/*] jobs: test: diff --git a/Cargo.lock b/Cargo.lock index 88fecb0a..72754b02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -874,7 +874,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hl" -version = "0.29.9" +version = "0.29.10" dependencies = [ "bincode", "byte-strings", diff --git a/Cargo.toml b/Cargo.toml index 06360d54..35a600a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = [".", "crate/encstr"] [workspace.package] repository = "https://github.com/pamburus/hl" authors = ["Pavel Ivanov "] -version = "0.29.9" +version = "0.29.10" edition = "2021" license = "MIT" diff --git a/src/fsmon.rs b/src/fsmon.rs index 3827a275..8be733d2 100644 --- a/src/fsmon.rs +++ b/src/fsmon.rs @@ -1,5 +1,5 @@ // std imports -use std::path::PathBuf; +use std::{path::PathBuf, time::Duration}; // local imports use crate::error::Result; @@ -124,7 +124,7 @@ mod imp { watcher.watch()?; while synced { - let event = if let Some(event) = watcher.poll(None) { + let event = if let Some(event) = watcher.poll(Some(Duration::from_secs(1))) { event } else { continue;