File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ public class AssignmentObserver: ObservableObject {
102
102
}
103
103
```
104
104
105
-
106
105
Rendering the view:
107
106
108
107
``` swift
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import Foundation;
2
2
3
3
// todo: make this a build argument (FF-1944)
4
4
public let sdkName = " ios "
5
- public let sdkVersion = " 3.0.1 "
5
+ public let sdkVersion = " 3.1.0 "
6
6
7
7
public enum Errors : Error {
8
8
case notConfigured
@@ -99,6 +99,14 @@ public class EppoClient {
99
99
}
100
100
return instance
101
101
}
102
+
103
+ // Loads the configuration from the remote source on-demand. Can be used to refresh as desired.
104
+ //
105
+ // This function can be called from multiple threads; synchronization is provided to safely update
106
+ // the configuration cache but each invocation will execute a new network request with billing impact.
107
+ public func load( ) async throws {
108
+ try await self . configurationStore. fetchAndStoreConfigurations ( )
109
+ }
102
110
103
111
public static func resetSharedInstance( ) {
104
112
sharedInstance = nil
Original file line number Diff line number Diff line change @@ -47,6 +47,27 @@ final class EppoTests: XCTestCase {
47
47
XCTAssertIdentical ( eppoClient1, eppoClient2, " Changing host re-instantiates the singleton " )
48
48
}
49
49
50
+ func testLoadingMultithreading( ) async throws {
51
+ let expectedCount = 50
52
+ let expectation = XCTestExpectation ( description: " eppo client expectation " )
53
+ expectation. expectedFulfillmentCount = expectedCount
54
+
55
+ Task {
56
+ await withThrowingTaskGroup ( of: Void . self) { group in
57
+ for _ in 0 ..< expectedCount {
58
+ group. addTask {
59
+ _ = try await EppoClient . initialize ( sdkKey: " mock-api-key " )
60
+ _ = try await EppoClient . shared ( ) . load ( )
61
+ expectation. fulfill ( )
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ await fulfillment ( of: [ expectation] , timeout: 5 )
68
+ XCTAssertEqual ( stubCallCount, 51 ) // initialize + 50 `load` executions
69
+ }
70
+
50
71
func testEppoClientMultithreading( ) async throws {
51
72
let expectedCount = 50
52
73
let expectation = XCTestExpectation ( description: " eppo client expectation " )
You can’t perform that action at this time.
0 commit comments