diff --git a/Bucketeer/Sources/Internal/Scheduler/EvaluationForegroundTask.swift b/Bucketeer/Sources/Internal/Scheduler/EvaluationForegroundTask.swift index b1503320..2e4bde1f 100644 --- a/Bucketeer/Sources/Internal/Scheduler/EvaluationForegroundTask.swift +++ b/Bucketeer/Sources/Internal/Scheduler/EvaluationForegroundTask.swift @@ -24,7 +24,7 @@ final class EvaluationForegroundTask: ScheduledTask { self.stop() guard let component = component else { return } self.poller = .init( - intervalMillis: isRetrying ? retryPollingInterval : component.config.eventsFlushInterval, + intervalMillis: isRetrying ? retryPollingInterval : component.config.pollingInterval, queue: queue, logger: component.config.logger, handler: { [weak self] _ in diff --git a/BucketeerTests/EvaluationForegroundTaskTests.swift b/BucketeerTests/EvaluationForegroundTaskTests.swift index dd7c6c97..330aca34 100644 --- a/BucketeerTests/EvaluationForegroundTaskTests.swift +++ b/BucketeerTests/EvaluationForegroundTaskTests.swift @@ -4,7 +4,7 @@ import XCTest final class EvaluationForegroundTaskTests: XCTestCase { func testStartAndReceiveSuccess() { let expectation = self.expectation(description: "") - expectation.expectedFulfillmentCount = 10 + expectation.expectedFulfillmentCount = 3 expectation.assertForOverFulfill = true let dispatchQueue = DispatchQueue(label: "default", qos: .default) @@ -33,7 +33,7 @@ final class EvaluationForegroundTaskTests: XCTestCase { let config = BKTConfig.mock( eventsFlushInterval: 10, eventsMaxQueueSize: 3, - pollingInterval: 100, + pollingInterval: 5000, // The minimum polling interval is 60 seconds, but is set to 5 seconds to shorten the test. backgroundPollingInterval: 1000 ) let component = MockComponent( @@ -47,7 +47,7 @@ final class EvaluationForegroundTaskTests: XCTestCase { ) task.start() - wait(for: [expectation], timeout: 0.3) + wait(for: [expectation], timeout: 20) } func testStartAndReceiveError() { @@ -79,7 +79,7 @@ final class EvaluationForegroundTaskTests: XCTestCase { let config = BKTConfig.mock( eventsFlushInterval: 50, eventsMaxQueueSize: 3, - pollingInterval: 100, + pollingInterval: 5000, // The minimum polling interval is 60 seconds, but is set to 5 seconds to shorten the test. backgroundPollingInterval: 1000 ) @@ -98,7 +98,7 @@ final class EvaluationForegroundTaskTests: XCTestCase { ) task.start() - wait(for: [expectation], timeout: 0.1) + wait(for: [expectation], timeout: 20) } func testStop() { diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift index d209bed6..e956a559 100644 --- a/Example/AppDelegate.swift +++ b/Example/AppDelegate.swift @@ -65,7 +65,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { .with(apiKey: apiKey) .with(apiEndpoint: apiEndpoint) .with(featureTag: "ios") - .with(pollingInterval: 5_000) + .with(pollingInterval: 150_000) .with(appVersion: bundle.infoDictionary?["CFBundleShortVersionString"] as! String) return try! builder.build() @@ -80,7 +80,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { apiKey: apiKey, apiEndpoint: apiEndpoint, featureTag: "ios", - pollingInterval: 5_000, + pollingInterval: 150_000, appVersion: bundle.infoDictionary?["CFBundleShortVersionString"] as! String, logger: nil )