@@ -1122,7 +1122,7 @@ extension LoggerStore {
11221122 }
11231123
11241124 private func reduceBlobStoreSize( ) throws {
1125- var currentSize = try getBlobsSize ( )
1125+ var currentSize = try getBlobsSize ( in : backgroundContext )
11261126
11271127 guard currentSize > configuration. blobSizeLimit else {
11281128 return // All good, no need to remove anything
@@ -1147,7 +1147,7 @@ extension LoggerStore {
11471147 }
11481148 }
11491149
1150- private func getBlobsSize( isDecompressed: Bool = false ) throws -> Int64 {
1150+ private func getBlobsSize( in context : NSManagedObjectContext , isDecompressed: Bool = false ) throws -> Int64 {
11511151 let request = LoggerBlobHandleEntity . fetchRequest ( )
11521152
11531153 let description = NSExpressionDescription ( )
@@ -1162,7 +1162,7 @@ extension LoggerStore {
11621162 request. propertiesToFetch = [ description]
11631163 request. resultType = . dictionaryResultType
11641164
1165- let result = try backgroundContext . fetch ( request) as? [ [ String : Any ] ]
1165+ let result = try context . fetch ( request) as? [ [ String : Any ] ]
11661166 return ( result? . first ? [ description. name] as? Int64 ) ?? 0
11671167 }
11681168}
@@ -1196,8 +1196,8 @@ extension LoggerStore {
11961196 taskCount: taskCount,
11971197 blobCount: blobCount,
11981198 totalStoreSize: try storeURL. directoryTotalSize ( ) ,
1199- blobsSize: try getBlobsSize ( ) ,
1200- blobsDecompressedSize: try getBlobsSize ( isDecompressed: true ) ,
1199+ blobsSize: try getBlobsSize ( in : context ) ,
1200+ blobsDecompressedSize: try getBlobsSize ( in : context , isDecompressed: true ) ,
12011201 appInfo: . current,
12021202 deviceInfo: deviceInfo
12031203 )
0 commit comments