ソースを参照

Try again doing the upload just via MOC updates… needs testing

Deniz Cengiz 1 年間 前
コミット
9a0105b033

+ 0 - 6
FreeAPS/Sources/APS/APSManager.swift

@@ -244,10 +244,6 @@ final class BaseAPSManager: APSManager, Injectable {
                     throw APSError.apsError(message: "Determine basal failed")
                 }
 
-                Task.detached(priority: .low) {
-                    await self.nightscout.uploadStatus()
-                }
-
                 // Open loop completed
                 guard settings.closedLoop else {
                     loopStatRecord.end = Date()
@@ -404,7 +400,6 @@ final class BaseAPSManager: APSManager, Injectable {
 
     func determineBasalSync() async {
         _ = await determineBasal()
-        await nightscout.uploadStatus()
     }
 
     func makeProfiles() async throws -> Bool {
@@ -740,7 +735,6 @@ final class BaseAPSManager: APSManager, Injectable {
                 debug(.apsManager, "Determination enacted. Enacted: \(wasEnacted)")
 
                 Task.detached(priority: .low) {
-                    await self.nightscout.uploadStatus()
                     await self.statistics()
                 }
             } else {

+ 6 - 6
FreeAPS/Sources/Services/Network/NightscoutManager.swift

@@ -370,7 +370,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         // Apparently we are too fast; so the flag update is not fast enough to have the predicate filter last suggestion out
         // If this check is truthy, set suggestion to nil so it's not uploaded again
         if let lastSuggested = lastSuggestedDetermination, let suggestion = modifiedSuggestedDetermination,
-           lastSuggested.deliverAt == suggestion.deliverAt 
+           lastSuggested.deliverAt == suggestion.deliverAt
         {
             modifiedSuggestedDetermination = nil
         }
@@ -996,10 +996,10 @@ extension BaseNightscoutManager {
                 await self.uploadOverrides()
             }
         }
-//        if determinationUpdates.isNotEmpty {
-//            Task.detached {
-//                await self.uploadStatus()
-//            }
-//        }
+        if determinationUpdates.isNotEmpty {
+            Task.detached {
+                await self.uploadStatus()
+            }
+        }
     }
 }