From 99408c1603e1eb984551fe2e05016be4f6599d9a Mon Sep 17 00:00:00 2001 From: Elle Sullivan Date: Wed, 24 Apr 2024 11:43:27 +0100 Subject: [PATCH] Fix DBP interrupt function not being cleared on succesful completion (#2690) Task/Issue URL: https://app.asana.com/0/1199230911884351/1207152863082294/f Tech Design URL: CC: **Description**: Straightforward, as title **Steps to test this PR**: 1. test DBP still works 2. Test the various pixels still work as expected. Test the interrupt pixel is called only when a function is actually interrupted 3. Test that an interrupt pixel and a completed successfully pixel are never fired at the same time --- ###### Internal references: [Pull Request Review Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f) [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) [Pull Request Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f) --- .../Scheduler/DataBrokerProtectionProcessor.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift index 5bb320d3d1..4e0cf5ac7d 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift @@ -70,10 +70,11 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .startManualScans(pendingCompletion: completion) runOperations(operationType: .scan, priorityDate: nil, - showWebView: showWebView) { errors in + showWebView: showWebView) { [weak self] errors in os_log("Scans done", log: .dataBrokerProtection) + self?.currentlyRunningOperationsForFunction = nil completion?(errors) - self.calculateMisMatches() + self?.calculateMisMatches() } } @@ -88,8 +89,9 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .runAllOptOutOperations(pendingCompletion: completion) runOperations(operationType: .optOut, priorityDate: nil, - showWebView: showWebView) { errors in + showWebView: showWebView) { [weak self] errors in os_log("Optouts done", log: .dataBrokerProtection) + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } } @@ -100,8 +102,9 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .runQueuedOperations(pendingCompletion: completion) runOperations(operationType: .all, priorityDate: Date(), - showWebView: showWebView) { errors in + showWebView: showWebView) { [weak self] errors in os_log("Queued operations done", log: .dataBrokerProtection) + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } } @@ -112,8 +115,9 @@ final class DataBrokerProtectionProcessor { currentlyRunningOperationsForFunction = .runAllOperations(pendingCompletion: completion) runOperations(operationType: .all, priorityDate: nil, - showWebView: showWebView) { errors in + showWebView: showWebView) { [weak self] errors in os_log("Queued operations done", log: .dataBrokerProtection) + self?.currentlyRunningOperationsForFunction = nil completion?(errors) } }