Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Apply suggested changes
  • Loading branch information
ark0f committed Feb 27, 2023
commit 889f37a30ec63260e95056069ca76b0f9d69de8b
4 changes: 1 addition & 3 deletions client/storage-monitor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use clap::Args;
use fs4::statvfs;
use sc_client_db::DatabaseSource;
use sp_core::traits::SpawnEssentialNamed;
use std::{
Expand Down Expand Up @@ -118,8 +117,7 @@ impl StorageMonitorService {

/// Returns free space in MB, or error if statvfs failed.
fn free_space(path: &Path) -> Result<u64, Error> {
let amount = statvfs(path)?;
Ok(amount.available_space() / (1024 * 1024))
Ok(fs4::available_space(path).map(|s| s / 1_000_000)?)
}

/// Checks if the amount of free space for given `path` is above given `threshold`.
Expand Down