Bladeren bron

Revert "unlimited loops"

This reverts commit c96aa87d4567ff1d8e1b45248618fbd9a3f1f3ea.
Robert 1 jaar geleden
bovenliggende
commit
f44f1409d1
2 gewijzigde bestanden met toevoegingen van 7 en 7 verwijderingen
  1. 6 6
      FreeAPS/Sources/APS/APSManager.swift
  2. 1 1
      FreeAPS/Sources/Config/Config.swift

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

@@ -186,12 +186,12 @@ final class BaseAPSManager: APSManager, Injectable {
     private func loop() {
         Task {
             // check the last start of looping is more the loopInterval but the previous loop was completed
-//        if lastLoopDate > lastStartLoopDate {
-//            guard lastStartLoopDate.addingTimeInterval(Config.loopInterval) < Date() else {
-//                debug(.apsManager, "too close to do a loop : \(lastStartLoopDate)")
-//                return
-//            }
-//        }
+            if lastLoopDate > lastLoopStartDate {
+                guard lastLoopStartDate.addingTimeInterval(Config.loopInterval) < Date() else {
+                    debug(.apsManager, "too close to do a loop : \(lastLoopStartDate)")
+                    return
+                }
+            }
 
             guard !isLooping.value else {
                 warning(.apsManager, "Loop already in progress. Skip recommendation.")

+ 1 - 1
FreeAPS/Sources/Config/Config.swift

@@ -4,6 +4,6 @@ import SwiftDate
 enum Config {
     static let treatWarningsAsErrors = true
     static let withSignPosts = false
-    static let loopInterval = 1.minutes.timeInterval
+    static let loopInterval = 4.minutes.timeInterval
     static let eхpirationInterval = 10.minutes.timeInterval
 }