             case .success, .noData:
                 results.append(result)
                 if results.count == expectedResultCount {
+                    defer { currentFetchRequest = nil }
                     os_log("All resources received.  Notifying completion.", type: .debug)
-                    currentFetchRequest = nil
                     if results.contains(.success) {
                         completionHandler(.success)
                     } else {

            return currentFetchRequest
        }
        
        let weightedUpdateOperations = [
            (Int64(4), updateAssignments),
            (Int64(1), updateLevelProgression),
            (Int64(2), updateReviewStatistics),
            (Int64(2), updateStudyMaterials),
            (Int64(4), updateSubjects),
            (Int64(1), updateUser),
            ]
        
        let expectedResultCount = weightedUpdateOperations.count
        let expectedTotalUnitCount = weightedUpdateOperations.reduce(1, { $0 + $1.0 })
        
        os_log("Scheduling resource fetch request", type: .debug)
        


private var currentFetchRequest: Progress?
private let fetchRequestLock = NSLock()

private typealias UpdateFunction = (TimeInterval, @escaping (ResourceRefreshResult) -> Void) -> Progress

extension ResourceRepository {
    var lastAppDataUpdateDate: Date? {
