瀏覽代碼

Calling calculateDiskStorageSize

Roman Podymov 3 年之前
父節點
當前提交
09a2496827
共有 1 個文件被更改,包括 2 次插入9 次删除
  1. 2 9
      Sources/Cache/ImageCache.swift

+ 2 - 9
Sources/Cache/ImageCache.swift

@@ -822,15 +822,8 @@ open class ImageCache {
     open var diskStorageSize: UInt {
         get async throws {
             try await withCheckedThrowingContinuation { continuation in
-                ioQueue.async {
-                    do {
-                        let size = try self.diskStorage.totalSize()
-                        Task { @MainActor in continuation.resume(returning: size) }
-                    } catch let error as KingfisherError {
-                        Task { @MainActor in continuation.resume(throwing: error) }
-                    } catch {
-                        assertionFailure("The internal thrown error should be a `KingfisherError`.")
-                    }
+                calculateDiskStorageSize { result in
+                    continuation.resume(with: result)
                 }
             }
         }