Skip to content

Commit

Permalink
Add semaphore to run 10 scans at once
Browse files Browse the repository at this point in the history
  • Loading branch information
jotaemepereira committed Mar 14, 2024
1 parent b9321fb commit f04373e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,18 @@ final class DataBrokerRunCustomJSONViewModel: ObservableObject {

Task.detached {
var scanResults = [DebugScanReturnValue]()
let semaphore = DispatchSemaphore(value: 10)
try await withThrowingTaskGroup(of: DebugScanReturnValue.self) { group in
for queryData in brokerProfileQueryData {
semaphore.wait()

Check warning on line 190 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift

View workflow job for this annotation

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6

Check warning on line 190 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift

View workflow job for this annotation

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6

Check warning on line 190 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift

View workflow job for this annotation

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6

Check warning on line 190 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift

View workflow job for this annotation

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6

Check warning on line 190 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift

View workflow job for this annotation

GitHub Actions / Test (Sandbox)

instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6

Check warning on line 190 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift

View workflow job for this annotation

GitHub Actions / Test (Sandbox)

instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6

Check warning on line 190 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerRunCustomJSONViewModel.swift

View workflow job for this annotation

GitHub Actions / Test (Non-Sandbox)

instance method 'wait' is unavailable from asynchronous contexts; Await a Task handle instead; this is an error in Swift 6
let debugScanOperation = DebugScanOperation(privacyConfig: self.privacyConfigManager, prefs: self.contentScopeProperties, query: queryData) {
true
}

group.addTask {
defer {
semaphore.signal()
}
do {
return try await debugScanOperation.run(inputValue: (), stageCalculator: FakeStageDurationCalculator(), showWebView: false)
} catch {
Expand Down

0 comments on commit f04373e

Please sign in to comment.