Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Home reads the free disk space away from the main thread
Țugui Dragoș5ee948f69ca3
diff --git a/Packages/PeelCore/Sources/PeelCore/Home/DeviceInfo.swift b/Packages/PeelCore/Sources/PeelCore/Home/DeviceInfo.swiftindex c55d2b22..b551bd48 100644--- a/Packages/PeelCore/Sources/PeelCore/Home/DeviceInfo.swift+++ b/Packages/PeelCore/Sources/PeelCore/Home/DeviceInfo.swift@@ -35,8 +35,10 @@ public struct DeviceInfo: Sendable, Hashable {}/// Returns a copy with the disk's total and free space read again. The other details don't change while- /// Peel is open, and the marketing name is slow to read.- public func withStorageRead(of home: URL = .homeDirectory) -> DeviceInfo {+ /// Peel is open, and the marketing name is slow to read. The free space for important use takes tens of+ /// milliseconds to read, so it is read away from the caller's actor.+ @concurrent+ public func withStorageRead(of home: URL = .homeDirectory) async -> DeviceInfo {DeviceInfo(model: model,modelIdentifier: modelIdentifier,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swiftindex fa239539..04c3bcc8 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HomeTests.swift@@ -52,6 +52,19 @@ struct DeviceInfoTests {#expect(DeviceInfo.storage(total: nil, available: nil, important: nil) == DeviceInfo.Storage(total: 0, free: 0))}+ @MainActor @Test func readsTheFreeSpaceAwayFromTheMainActor() async {+ final class Turn {+ var taken = false+ }+ let device = await DeviceInfo.withoutTheModelName()+ let turn = Turn()+ Task { @MainActor in turn.taken = true }++ _ = await device.withStorageRead()++ #expect(turn.taken)+ }+@Test func leavesOutAZeroPatchVersion() {#expect(DeviceInfo.versionString(OperatingSystemVersion(majorVersion: 26, minorVersion: 7, patchVersion: 0)) == "26.7")#expect(DeviceInfo.versionString(OperatingSystemVersion(majorVersion: 26, minorVersion: 7, patchVersion: 1)) == "26.7.1")diff --git a/Peel/Model/HomeModel.swift b/Peel/Model/HomeModel.swiftindex 7937a813..b7c4db2f 100644--- a/Peel/Model/HomeModel.swift+++ b/Peel/Model/HomeModel.swift@@ -171,7 +171,7 @@ final class HomeModel {// Free space is read every time, since it is how the user sees that a cleanup worked.if !isFirstRead, let device {- self.device = device.withStorageRead().named(modelName)+ self.device = await device.withStorageRead().named(modelName)}}