Browse Source

Calling calculateDiskStorageSize

Roman Podymov 3 years ago
parent
commit
09a2496827
1 changed files with 2 additions and 9 deletions
  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)
                 }
             }
         }