Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Apply suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ark0f committed Feb 27, 2023
1 parent ef70db1 commit 22ad266
Showing 1 changed file with 1 addition and 3 deletions.
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

0 comments on commit 22ad266

Please sign in to comment.