From 271554c002074984b9e465db679373728e83dace Mon Sep 17 00:00:00 2001 From: masaaania Date: Mon, 21 Aug 2023 12:31:37 +0900 Subject: [PATCH 1/3] fix: evaluation polling interval setting --- .../Sources/Internal/Scheduler/EvaluationForegroundTask.swift | 2 +- Example/AppDelegate.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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/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 ) From 49df657d323a2802603b0ec175467944ab58a490 Mon Sep 17 00:00:00 2001 From: masaaania Date: Mon, 21 Aug 2023 16:55:12 +0900 Subject: [PATCH 2/3] fix unit test --- BucketeerTests/EvaluationForegroundTaskTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BucketeerTests/EvaluationForegroundTaskTests.swift b/BucketeerTests/EvaluationForegroundTaskTests.swift index dd7c6c97..c3a45953 100644 --- a/BucketeerTests/EvaluationForegroundTaskTests.swift +++ b/BucketeerTests/EvaluationForegroundTaskTests.swift @@ -33,7 +33,7 @@ final class EvaluationForegroundTaskTests: XCTestCase { let config = BKTConfig.mock( eventsFlushInterval: 10, eventsMaxQueueSize: 3, - pollingInterval: 100, + pollingInterval: 5000, 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, 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() { From af687d50148ce0058b6787d4571dd820ac5ac2ab Mon Sep 17 00:00:00 2001 From: masaaania Date: Mon, 21 Aug 2023 18:19:55 +0900 Subject: [PATCH 3/3] fix unit test --- BucketeerTests/EvaluationForegroundTaskTests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BucketeerTests/EvaluationForegroundTaskTests.swift b/BucketeerTests/EvaluationForegroundTaskTests.swift index c3a45953..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: 5000, + pollingInterval: 5000, // The minimum polling interval is 60 seconds, but is set to 5 seconds to shorten the test. backgroundPollingInterval: 1000 ) let component = MockComponent( @@ -79,7 +79,7 @@ final class EvaluationForegroundTaskTests: XCTestCase { let config = BKTConfig.mock( eventsFlushInterval: 50, eventsMaxQueueSize: 3, - pollingInterval: 5000, + pollingInterval: 5000, // The minimum polling interval is 60 seconds, but is set to 5 seconds to shorten the test. backgroundPollingInterval: 1000 )