From c65ff9b5369de4927a010b327a80ce48aff8e098 Mon Sep 17 00:00:00 2001 From: Christopher Hoffmann Date: Fri, 15 Jan 2021 13:27:10 -0700 Subject: [PATCH 1/4] Update docs for GA (#503) * update usage docs * remove beta acknowledge * Update MobileCore.md fix missing objective c header * Update Identity.md remove reference to AEPError * update install instructions and requirements * add AEPSignal to podfile instructions --- Documentation/Usage/Identity.md | 8 ++--- Documentation/Usage/MobileCore.md | 57 +++++++++++++++++++++++++------ README.md | 23 ++++--------- 3 files changed, 58 insertions(+), 30 deletions(-) diff --git a/Documentation/Usage/Identity.md b/Documentation/Usage/Identity.md index fc3ebeb8f..d5cdd7f7a 100644 --- a/Documentation/Usage/Identity.md +++ b/Documentation/Usage/Identity.md @@ -19,7 +19,7 @@ Identity.appendTo(url: URL(string: "yourUrl.com")) { (url, error) in ###### Objective-C ```objective-c -[AEPMobileIdentity appendToUrl:[NSURL URLWithString:@"yourUrl.com"] completion:^(NSURL * _Nullable url, enum AEPError error) { +[AEPMobileIdentity appendToUrl:[NSURL URLWithString:@"yourUrl.com"] completion:^(NSURL * _Nullable url, NSError * error) { // handle completion }]; ``` @@ -37,7 +37,7 @@ Identity.getUrlVariables { (vars, error) in ###### Objective-C ```objective-c -[AEPMobileIdentity getUrlVariables:^(NSString * _Nullable vars, enum AEPError error) { +[AEPMobileIdentity getUrlVariables:^(NSString * _Nullable vars, NSError * error) { // handle completion }]; ``` @@ -55,7 +55,7 @@ Identity.getIdentifiers { (ids, error) in ###### Objective-C ```objective-c -[AEPMobileIdentity getIdentifiers:^(NSArray> * _Nullable ids, enum AEPError error) { +[AEPMobileIdentity getIdentifiers:^(NSArray> * _Nullable ids, NSError * error) { // handle completion }]; ``` @@ -132,4 +132,4 @@ NSDictionary *identifiers = @{@"idType1":@"idValue1", [AEPMobileIdentity syncIdentifiers:identifiers authenticationState:AEPMobileVisitorAuthStateAuthenticated]; ``` -##### \ No newline at end of file +##### diff --git a/Documentation/Usage/MobileCore.md b/Documentation/Usage/MobileCore.md index 6728cb296..b6bc46933 100644 --- a/Documentation/Usage/MobileCore.md +++ b/Documentation/Usage/MobileCore.md @@ -113,6 +113,24 @@ let registered = MobileCore.getRegisteredExtensions() NSString *registered = [AEPMobileCore getRegisteredExtensions]; ``` +##### Registering an event listener + +###### Swift + +```swift +MobileCore.registerEventListener(type: type, source: source, listener: { event in + // handle event +}) +``` + +###### Objective-C + +```objective-c +[AEPMobileCore registerEventListenerWithType: type source: source listener:^(AEPEvent * _Nonnull event) { + // handle event +}]; +``` + ##### Configuring the SDK with an app id: ###### Swift @@ -176,13 +194,13 @@ NSDictionary *updatedConfig = @{ @"analytics.rsids": @"your-rsids"}; ###### Swift ```swift -MobileCore.setPrivacy(status: .optedOut) +MobileCore.setPrivacyStatus(.optedOut) ``` ###### Objective-C ```objective-c -[AEPMobileCore setPrivacy:AEPPrivacyStatusOptedOut]; +[AEPMobileCore setPrivacyStatus:AEPPrivacyStatusOptedOut]; ``` ##### Reading the privacy status: @@ -219,7 +237,7 @@ MobileCore.getPrivacyStatus { (privacyStatus) in ###### Swift ```swift -MobileCore.setLogLevel(level: .trace) +MobileCore.setLogLevel(.trace) ``` ###### Objective-C @@ -291,13 +309,32 @@ AEPEvent *event = [[AEPEvent alloc] initWithName:@"My Event" type:AEPEventType.c // handle responseEvent }]; ``` +##### Dispatching an `Event` with a timeout: + +###### Swift + +```swift +let event = Event(name: "My Event", type: EventType.custom, source: EventType.custom, data: ["exampleKey": "exampleVal"]) +MobileCore.dispatch(event: event, timeout: 2) { (responseEvent) in + // handle responseEvent +} +``` + +###### Objective-C + +```objective-c +AEPEvent *event = [[AEPEvent alloc] initWithName:@"My Event" type:AEPEventType.custom source:AEPEventType.custom data:@{@"exampleKey": @"exampleVal"}]; +[AEPMobileCore dispatch:event timeout: 2 responseCallback:^(AEPEvent * _Nullable responseEvent) { + // handle responseEvent +}]; +``` ##### Setting the advertising identifier: ###### Swift ```swift -MobileCore.setAdvertisingIdentifier(adId: "my-ad-id") +MobileCore.setAdvertisingIdentifier("my-ad-id") ``` ###### Objective-C @@ -312,7 +349,7 @@ MobileCore.setAdvertisingIdentifier(adId: "my-ad-id") ```swift // Set the deviceToken that the APNS has assigned to the device -MobileCore.setPushIdentifier(deviceToken: deviceToken) +MobileCore.setPushIdentifier(deviceToken) ``` ###### Objective-C @@ -340,7 +377,7 @@ MobileCore.setPushIdentifier(deviceToken: deviceToken) ###### Swift ```swift -MobileCore.setWrapperType(type: .flutter) +MobileCore.setWrapperType(.flutter) ``` ###### Objective-C @@ -356,7 +393,7 @@ MobileCore.setWrapperType(type: .flutter) ###### Swift ```swift -MobileCore.setAppGroup(group: "your-app-group") +MobileCore.setAppGroup("your-app-group") ``` ###### Objective-C @@ -378,7 +415,7 @@ MobileCore.getSdkIdentities { (ids, error) in ###### Objective-C ```objective-c -[AEPMobileCore getSdkIdentities:^(NSString * _Nullable ids, enum AEPError error) { +[AEPMobileCore getSdkIdentities:^(NSString * _Nullable ids, NSError* _Nullable error) { // handle completion }]; ``` @@ -389,7 +426,7 @@ MobileCore.getSdkIdentities { (ids, error) in ```swift let messageInfo = ["testKey": "testVal"] -MobileCore.collectMessageInfo(messageInfo: messageInfo) +MobileCore.collectMessageInfo(messageInfo) ``` ###### Objective-C @@ -405,7 +442,7 @@ NSDictionary *messageInfo = @{@"testKey": @"testVal"} ```swift let data = ["testKey": "testVal"] -MobileCore.collectPii(data: data) +MobileCore.collectPii(data) ``` ###### Objective-C diff --git a/README.md b/README.md index 4261a7d2a..63a9e0b58 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,13 @@ on [![Cocoapods](https://img.shields.io/cocoapods/v/AEPCore.svg?color=orange&lab [![CircleCI](https://img.shields.io/circleci/project/github/adobe/aepsdk-core-ios/master.svg?logo=circleci)](https://circleci.com/gh/adobe/workflows/aepsdk-core-ios) [![Code Coverage](https://img.shields.io/codecov/c/github/adobe/aepsdk-core-ios/main.svg?logo=codecov)](https://codecov.io/gh/adobe/aepsdk-core-ios/branch/main) -## BETA ACKNOWLEDGEMENT - -AEPCore is currently in Beta. Use of this code is by invitation only and not otherwise supported by Adobe. Please contact your Adobe Customer Success Manager to learn more. - -By using the Beta, you hereby acknowledge that the Beta is provided "as is" without warranty of any kind. Adobe shall have no obligation to maintain, correct, update, change, modify or otherwise support the Beta. You are advised to use caution and not to rely in any way on the correct functioning or performance of such Beta and/or accompanying materials. - ## About this project The Mobile Core represents the core Adobe Experience Platform SDK that is required for every app implementation. The core contains a common set of functionality and frameworks, such as Experience Cloud Identity services, data event hub, Rules Engine, reusable networking, disk access routines, and so on, which are required by all Adobe and third-party extensions. ## Requirements -- Xcode 11.x -- Swift 5.x +- Xcode 11.0 (or newer) +- Swift 5.1 (or newer) ## Installation These are currently the supported installation options: @@ -31,18 +25,15 @@ use_frameworks! # for app development, include all the following pods target 'YOUR_TARGET_NAME' do - pod 'AEPServices', :git => 'https://github.com/adobe/aepsdk-core-ios.git', :branch => 'main' - pod 'AEPCore', :git => 'https://github.com/adobe/aepsdk-core-ios.git', :branch => 'main' - pod 'AEPLifecycle', :git => 'https://github.com/adobe/aepsdk-core-ios.git', :branch => 'main' - pod 'AEPIdentity', :git => 'https://github.com/adobe/aepsdk-core-ios.git', :branch => 'main' - pod 'AEPRulesEngine', :git => 'https://github.com/adobe/aepsdk-rulesengine-ios.git', :branch => 'main' + pod 'AEPCore' + pod 'AEPLifecycle' + pod 'AEPIdentity' + pod 'AEPSignal' end # for extension development, include AEPCore and its dependencies target 'YOUR_TARGET_NAME' do - pod 'AEPCore', :git => 'https://github.com/adobe/aepsdk-core-ios.git', :branch => 'main' - pod 'AEPServices', :git => 'https://github.com/adobe/aepsdk-core-ios.git', :branch => 'main' - pod 'AEPRulesEngine', :git => 'https://github.com/adobe/aepsdk-rulesengine-ios.git', :branch => 'main' + pod 'AEPCore' end ``` From 8b5aa0fa929ab7e47f8ea5788972118f0ec4e4bf Mon Sep 17 00:00:00 2001 From: Yansong Yang Date: Fri, 15 Jan 2021 14:38:51 -0600 Subject: [PATCH 2/4] Update release.yml (#505) --- .github/workflows/release.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d1c231d1..c95f702c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,11 +9,6 @@ on: required: true default: '1.0.0' - action_verification: - description: 'Pod/SPM verification ("no" to skip)' - required: true - default: 'yes' - action_tag: description: 'create tag ("no" to skip)' required: true @@ -65,14 +60,14 @@ jobs: make check-version VERSION=${{ github.event.inputs.tag }} - name: SPM integration test - if: ${{ github.event.inputs.action_verification == 'yes' }} + if: ${{ github.event.inputs.action_tag == 'yes' }} run: | set -eo pipefail echo SPM integration test starts: make test-SPM-integration - name: podspec file verification - if: ${{ github.event.inputs.action_verification == 'yes' }} + if: ${{ github.event.inputs.action_tag == 'yes' }} run: | set -eo pipefail echo podspec file verification starts: From 6713bfd8c5272d1a910e80274145c7c3e4b572b7 Mon Sep 17 00:00:00 2001 From: Arjun Bhadra Date: Fri, 15 Jan 2021 12:53:21 -0800 Subject: [PATCH 3/4] Revert batchLimit changes (#506) Co-authored-by: Jiabin Geng --- .../Sources/IdentityHitProcessor.swift | 1 - AEPServices/Mocks/MockHitProcessor.swift | 2 - .../utility/hitprocessor/HitProcessing.swift | 3 - .../hitprocessor/PersistentHitQueue.swift | 33 +- .../utility/PersistentHitQueueTests.swift | 335 ------------------ AEPSignal/Sources/SignalHitProcessor.swift | 1 - 6 files changed, 3 insertions(+), 372 deletions(-) diff --git a/AEPIdentity/Sources/IdentityHitProcessor.swift b/AEPIdentity/Sources/IdentityHitProcessor.swift index 77ac5f416..56a825bdc 100644 --- a/AEPIdentity/Sources/IdentityHitProcessor.swift +++ b/AEPIdentity/Sources/IdentityHitProcessor.swift @@ -27,7 +27,6 @@ class IdentityHitProcessor: HitProcessing { } // MARK: HitProcessing - var batchLimit = 0 func retryInterval(for entity: DataEntity) -> TimeInterval { return TimeInterval(30) diff --git a/AEPServices/Mocks/MockHitProcessor.swift b/AEPServices/Mocks/MockHitProcessor.swift index 80a586696..f847a61fa 100644 --- a/AEPServices/Mocks/MockHitProcessor.swift +++ b/AEPServices/Mocks/MockHitProcessor.swift @@ -13,10 +13,8 @@ import Foundation public class MockHitProcessor: HitProcessing { - public var batchLimit: Int public init() { - self.batchLimit = 0 } public func retryInterval(for entity: DataEntity) -> TimeInterval { diff --git a/AEPServices/Sources/utility/hitprocessor/HitProcessing.swift b/AEPServices/Sources/utility/hitprocessor/HitProcessing.swift index c04af0a2a..b48b9b972 100644 --- a/AEPServices/Sources/utility/hitprocessor/HitProcessing.swift +++ b/AEPServices/Sources/utility/hitprocessor/HitProcessing.swift @@ -14,9 +14,6 @@ import Foundation /// A class of types who provide the functionality for processing hits public protocol HitProcessing: class { - /// batchLimit: an `Int` specifies the number of hits to be batched to start processing hits - var batchLimit: Int { get set} - /// Determines the interval at which a hit should be retried /// - Parameter entity: The hit whose retry interval is to be computed func retryInterval(for entity: DataEntity) -> TimeInterval diff --git a/AEPServices/Sources/utility/hitprocessor/PersistentHitQueue.swift b/AEPServices/Sources/utility/hitprocessor/PersistentHitQueue.swift index 4ee74f481..71b40b5f6 100644 --- a/AEPServices/Sources/utility/hitprocessor/PersistentHitQueue.swift +++ b/AEPServices/Sources/utility/hitprocessor/PersistentHitQueue.swift @@ -19,8 +19,6 @@ public class PersistentHitQueue: HitQueuing { private static let DEFAULT_RETRY_INTERVAL = TimeInterval(30) private var suspended = true private let queue = DispatchQueue(label: "com.adobe.mobile.persistenthitqueue") - private var currentBatchSize = 0 - private var batching = false /// Creates a new `HitQueue` with the underlying `DataQueue` which is used to persist hits /// - Parameter dataQueue: a `DataQueue` used to persist hits @@ -39,23 +37,15 @@ public class PersistentHitQueue: HitQueuing { public func beginProcessing() { queue.async { self.suspended = false } - batching = self.processor.batchLimit > 0 processNextHit() } - // Processes the queued hits ignoring the batchLimit - public func forceProcessing() { - queue.async { self.suspended = false } - processNextHit(ignoreBatchLimit: true) - } - public func suspend() { queue.async { self.suspended = true } } public func clear() { _ = dataQueue.clear() - self.currentBatchSize = 0 } public func count() -> Int { @@ -68,20 +58,8 @@ public class PersistentHitQueue: HitQueuing { } /// A recursive function for processing hits, it will continue processing all the hits until none are left in the data queue - /// - Parameter ignoreBatchLimit: a `Bool` flag to determine batching hits - private func processNextHit(ignoreBatchLimit: Bool = false) { + private func processNextHit() { queue.async { - if self.batching && !ignoreBatchLimit { - // check if number of queued hits > batchLimit and currently we are not processing a batch of hits - if self.dataQueue.count() >= self.processor.batchLimit && self.currentBatchSize == 0 { - // There is no batch being processed currently so set the currentBatchSize to batchLimit - self.currentBatchSize = self.processor.batchLimit - } - - // Only process hits if number of queued hits >= batchLimit - guard self.currentBatchSize > 0 else { return } - } - guard !self.suspended else { return } guard let hit = self.dataQueue.peek() else { return } // nothing left in the queue, stop processing @@ -91,16 +69,11 @@ public class PersistentHitQueue: HitQueuing { // successful processing of hit, remove it from the queue, move to next hit _ = self?.dataQueue.remove() - if self?.batching ?? false { - // Successfully processed hit, so update the currentBatchSize to reflect remaining number of hits to be processed - self?.currentBatchSize -= 1 - } - - self?.processNextHit(ignoreBatchLimit: ignoreBatchLimit) + self?.processNextHit() } else { // processing hit failed, leave it in the queue, retry after the retry interval self?.queue.asyncAfter(deadline: .now() + (self?.processor.retryInterval(for: hit) ?? PersistentHitQueue.DEFAULT_RETRY_INTERVAL)) { - self?.processNextHit(ignoreBatchLimit: ignoreBatchLimit) + self?.processNextHit() } } diff --git a/AEPServices/Tests/utility/PersistentHitQueueTests.swift b/AEPServices/Tests/utility/PersistentHitQueueTests.swift index acc1ce879..98623b649 100644 --- a/AEPServices/Tests/utility/PersistentHitQueueTests.swift +++ b/AEPServices/Tests/utility/PersistentHitQueueTests.swift @@ -27,14 +27,6 @@ class PersistentHitQueueTests: XCTestCase { hitQueue = PersistentHitQueue(dataQueue: MockDataQueue(), processor: hitProcessor) } - /// setup hitProcessor with batchLimit - /// - Parameter batchLimit: `Int` spcifies the number of hits to be batched - func setUpWith(batchLimit: Int) { - hitProcessor = MockHitProcessor() - hitProcessor.batchLimit = batchLimit - hitQueue = PersistentHitQueue(dataQueue: MockDataQueue(), processor: hitProcessor) - } - /// Tests that when the queue is in a suspended state that we store the hit in the data queue and do not invoke the processor func testDoesntProcessByDefault() { // setup @@ -49,21 +41,6 @@ class PersistentHitQueueTests: XCTestCase { XCTAssertTrue(result) // queuing hit should be successful } - /// Tests that when the queue is in a suspended state that we store the hit in the data queue and do not invoke the processor - func testDoesntProcessByDefaultWithBatchLimit() { - // setup - setUpWith(batchLimit: 5) - let entity = DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil) - - // test - let result = hitQueue.queue(entity: entity) - - // verify - XCTAssertEqual(hitQueue.dataQueue.peek(), entity) // hit should be in persistent queue - XCTAssertTrue(processedHits.isEmpty) // mock hit processor should have never been invoked with the data entity - XCTAssertTrue(result) // queuing hit should be successful - } - /// Tests that when the queue is in a suspended state that we store the hit in the data queue and do not invoke the processor func testClearQueue() { // setup @@ -79,22 +56,6 @@ class PersistentHitQueueTests: XCTestCase { XCTAssertTrue(result) // queuing hit should be successful } - /// Tests that when the queue is in a suspended state that we store the hit in the data queue and do not invoke the processor - func testClearQueueWithBatchLimit() { - // setup - setUpWith(batchLimit: 5) - let entity = DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil) - - // test - let result = hitQueue.queue(entity: entity) - hitQueue.clear() - - // verify - XCTAssertNil(hitQueue.dataQueue.peek()) // hit should no longer be in the queue - XCTAssertTrue(processedHits.isEmpty) // mock hit processor should have never been invoked with the data entity - XCTAssertTrue(result) // queuing hit should be successful - } - /// Tests that when the queue is not in a suspended state that the hit processor is invoked with the hit func testProcessesHit() { // setup @@ -111,47 +72,6 @@ class PersistentHitQueueTests: XCTestCase { XCTAssertTrue(result) // queuing hit should be successful } - /// Tests that when the queue is not in a suspended state and batchLimit is set that the hit processor is invoked with the hit only after queueSize >= batchLimit - func testProcessesHitWithBatchLimit() { - // setup - setUpWith(batchLimit: 5) - let entity = DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil) - let entity1 = DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil) - let entity2 = DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil) - let entity3 = DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil) - let entity4 = DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil) - - - // test - let result = hitQueue.queue(entity: entity) - hitQueue.beginProcessing() - sleep(1) - - // verify - XCTAssertNotNil(hitQueue.dataQueue.peek()) // some hits should still be in the queue - XCTAssertNil(processedHits.first) // mock hit processor should not have been invoked with the data entity - XCTAssertTrue(result) // queuing hit should be successful - - let result1 = hitQueue.queue(entity: entity1) - XCTAssertTrue(result1) - let result2 = hitQueue.queue(entity: entity2) - XCTAssertTrue(result2) - let result3 = hitQueue.queue(entity: entity3) - XCTAssertTrue(result3) - let result4 = hitQueue.queue(entity: entity4) - XCTAssertTrue(result4) - - sleep(1) - - // verify - XCTAssertEqual(hitQueue.dataQueue.count(), 0) // no hits should be present in the queue - XCTAssertEqual(processedHits[0], entity) // mock hit processor should have been invoked with the data entity - XCTAssertEqual(processedHits[1], entity1) // mock hit processor should have been invoked with the data entity - XCTAssertEqual(processedHits[2], entity2) // mock hit processor should have been invoked with the data entity - XCTAssertEqual(processedHits[3], entity3) // mock hit processor should have been invoked with the data entity - XCTAssertEqual(processedHits[4], entity4) // mock hit processor should have been invoked with the data entity - } - /// Tests that multiple hits are processed and the data queue is empty func testProcessesHits() { // setup @@ -189,42 +109,6 @@ class PersistentHitQueueTests: XCTestCase { XCTAssertEqual(100, processedHits.count) // all 100 hits should have been processed } - /// Tests that many hits are processed and the data queue is empty when the batchLimit is reached - func testProcessesHitsManyWithBatchLimit() { - // setup - setUpWith(batchLimit: 10) - hitQueue.beginProcessing() - - // test - for _ in 0 ..< 100 { - hitQueue.queue(entity: DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil)) - } - - sleep(1) - - // verify - XCTAssertNil(hitQueue.dataQueue.peek()) // hit should no longer be in the queue as its been processed - XCTAssertEqual(100, processedHits.count) // all 100 hits should have been processed - } - - /// Tests that many hits are processed and the data queue has few hits unproxessed when the batchLimit is not reached - func testProcessesHitsManyWithBatchLimitFewHitsLeft() { - // setup - setUpWith(batchLimit: 10) - hitQueue.beginProcessing() - - // test - for _ in 0 ..< 97 { - hitQueue.queue(entity: DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil)) - } - - sleep(1) - - // verify - XCTAssertNotNil(hitQueue.dataQueue.peek()) // some hits should still be in the queue - XCTAssertEqual(90, processedHits.count) // 90 hits should have been processed - } - /// Tests that not all hits are processed when we suspend the queue func testProcessesHitsManyWithSuspend() { // test @@ -240,24 +124,6 @@ class PersistentHitQueueTests: XCTestCase { XCTAssertNotEqual(100, processedHits.count) // we should have not processed all 100 hits by the time we have suspended } - /// Tests that not all hits are processed when we suspend the queue even when the batchLimit is reached - func testProcessesHitsManyWithBatchLimitWithSuspend() { - // setup - setUpWith(batchLimit: 10) - - // test - for _ in 0 ..< 100 { - hitQueue.queue(entity: DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil)) - } - - hitQueue.suspend() - sleep(1) - - // verify - XCTAssertNotNil(hitQueue.dataQueue.peek()) // some hits should still be in the queue - XCTAssertNotEqual(100, processedHits.count) // we should have not processed all 100 hits by the time we have suspended - } - /// Tests that not all hits are processed when we suspend the queue, but then when we resume processing the remaining hits are processed func testProcessesHitsManyWithSuspendThenResume() { // test @@ -280,56 +146,6 @@ class PersistentHitQueueTests: XCTestCase { XCTAssertEqual(100, processedHits.count) // now all hits should have been sent to the hit processor } - /// Tests that not all hits are processed when we suspend the queue, but then when we resume processing the remaining hits are processed when the batchLimit is reached - func testProcessesHitsManyWithBatchLimitWithSuspendThenResume() { - // setup - setUpWith(batchLimit: 10) - - // test - for _ in 0 ..< 100 { - hitQueue.queue(entity: DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil)) - } - - hitQueue.suspend() - sleep(1) - - // verify - XCTAssertNotNil(hitQueue.dataQueue.peek()) // hit should no longer be in the queue as its been processed - XCTAssertNotEqual(100, processedHits.count) // all 100 hits should have been processed - - hitQueue.beginProcessing() - sleep(1) - - // verify pt. 2 - XCTAssertNil(hitQueue.dataQueue.peek()) // hit should no longer be in the queue as its been processed - XCTAssertEqual(100, processedHits.count) // now all hits should have been sent to the hit processor - } - - /// Tests that not all hits are processed when we suspend the queue, but then when we resume processing that the remaining hits are processed when the batchLimit is reached - func testProcessesHitsManyWithBatchLimitWithSuspendThenResumeFewHitLeft() { - // setup - setUpWith(batchLimit: 10) - - // test - for _ in 0 ..< 97 { - hitQueue.queue(entity: DataEntity(uniqueIdentifier: UUID().uuidString, timestamp: Date(), data: nil)) - } - - hitQueue.suspend() - sleep(1) - - // verify - XCTAssertNotNil(hitQueue.dataQueue.peek()) // hit should no longer be in the queue as its been processed - XCTAssertNotEqual(100, processedHits.count) // all 100 hits should have been processed - - hitQueue.beginProcessing() - sleep(1) - - // verify pt. 2 - XCTAssertEqual(hitQueue.dataQueue.count(), 7) // hits should be in the queue as they have not been processed since count() func retryInterval(for entity: DataEntity) -> TimeInterval { @@ -514,8 +181,6 @@ class MockHitProcessor: HitProcessing { } class MockHitIntermittentProcessor: HitProcessing { - var batchLimit = 0 - let processedHits = ThreadSafeArray() var failedHits = Set() diff --git a/AEPSignal/Sources/SignalHitProcessor.swift b/AEPSignal/Sources/SignalHitProcessor.swift index feaa37c90..0bd8b8ea3 100644 --- a/AEPSignal/Sources/SignalHitProcessor.swift +++ b/AEPSignal/Sources/SignalHitProcessor.swift @@ -21,7 +21,6 @@ class SignalHitProcessor: HitProcessing { } // MARK: - HitProcessing - var batchLimit = 0 func retryInterval(for entity: DataEntity) -> TimeInterval { return TimeInterval(30) From e3882cf2840d70d0b25d1c81254d0b369e6b5d8c Mon Sep 17 00:00:00 2001 From: Yansong Yang Date: Fri, 15 Jan 2021 15:46:47 -0600 Subject: [PATCH 4/4] update variable name (#509) --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c95f702c5..c05123ce1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,8 +14,8 @@ on: required: true default: 'yes' - release_AEPService: - description: 'release AEPService ("no" to skip)' + release_AEPServices: + description: 'release AEPServices ("no" to skip)' required: true default: 'yes' @@ -85,7 +85,7 @@ jobs: # pod lib lint AEPServices.podspec --allow-warnings --swift-version=5.1 - name: Publish Pods - AEPService - if: ${{ github.event.inputs.release_AEPService == 'yes' }} + if: ${{ github.event.inputs.release_AEPServices == 'yes' }} run: | set -eo pipefail pod trunk push AEPServices.podspec --allow-warnings --synchronous --swift-version=5.1