Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: evaluation polling interval setting #31

Merged
merged 3 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions BucketeerTests/EvaluationForegroundTaskTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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(
Expand All @@ -47,7 +47,7 @@ final class EvaluationForegroundTaskTests: XCTestCase {
)
task.start()

wait(for: [expectation], timeout: 0.3)
wait(for: [expectation], timeout: 20)
}

func testStartAndReceiveError() {
Expand Down Expand Up @@ -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
)

Expand All @@ -98,7 +98,7 @@ final class EvaluationForegroundTaskTests: XCTestCase {
)
task.start()

wait(for: [expectation], timeout: 0.1)
wait(for: [expectation], timeout: 20)
}

func testStop() {
Expand Down
4 changes: 2 additions & 2 deletions Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
)
Expand Down