Skip to content

Commit aa7bb02

Browse files
committed
Rename FailFastOperationQueue to StressTesterOperationQueue
We are no longer using this queue to fail fast, so the name seems misleading.
1 parent 4a404b2 commit aa7bb02

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

SourceKitStressTester/Sources/SwiftCWrapper/FailFastOperationQueue.swift renamed to SourceKitStressTester/Sources/SwiftCWrapper/StressTesterOperationQueue.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import Foundation
1414

1515
/// An operation queue that stops scheduling new operations as soon as the the
1616
/// completion handler returns `false`.
17-
public final class FailFastOperationQueue<Item: Operation> {
18-
private let serialQueue = DispatchQueue(label: "\(FailFastOperationQueue.self)")
17+
public final class StressTesterOperationQueue<Item: Operation> {
18+
private let serialQueue = DispatchQueue(label: "\(StressTesterOperationQueue.self)")
1919
private let queue = OperationQueue()
2020
private let operations: [Item]
21-
private let completionHandler: (Int, Item, Int, Int) -> Bool
21+
private let completionHandler: (_ index: Int, _ operation: Item, _ operationsCompleted: Int, _ totalOperationCount: Int) -> Bool
2222

2323
public init(operations: [Item], maxWorkers: Int? = nil,
2424
completionHandler: @escaping (Int, Item, Int, Int) -> Bool) {

SourceKitStressTester/Sources/SwiftCWrapper/SwiftCWrapper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public struct SwiftCWrapper {
129129
}
130130
}
131131

132-
let queue = FailFastOperationQueue(operations: operations, maxWorkers: maxJobs) { index, operation, completed, total -> Bool in
132+
let queue = StressTesterOperationQueue(operations: operations, maxWorkers: maxJobs) { index, operation, completed, total -> Bool in
133133
let message = "\(operation.file) (\(operation.summary)): \(operation.status.name)"
134134
progress?.update(step: completed, total: total, text: message)
135135
orderingHandler?.complete(operation.responses, at: index, setLast: !operation.status.isPassed)

SourceKitStressTester/Tests/SwiftCWrapperToolTests/SwiftCWrapperToolTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class SwiftCWrapperToolTests: XCTestCase {
7575
}
7676
}
7777

78-
func testFailFastOperationQueue() throws {
78+
func testStressTesterOperationQueue() throws {
7979
class TestOperation: Operation {
8080
var waitCount: Int
8181

@@ -96,13 +96,13 @@ class SwiftCWrapperToolTests: XCTestCase {
9696
let third = TestOperation(waitCount: 20)
9797
let fourth = TestOperation(waitCount: 30)
9898

99-
FailFastOperationQueue(operations: [first, second, third, fourth], maxWorkers: 2, completionHandler: { _, finishedOp, _, _ in
99+
StressTesterOperationQueue(operations: [first, second, third, fourth], maxWorkers: 2, completionHandler: { _, finishedOp, _, _ in
100100
// cancel later operations when the second operation completes
101101
return finishedOp !== second
102102
}).waitUntilFinished()
103103

104-
XCTAssertTrue(!first.isCancelled, "first was cancelled")
105-
XCTAssertTrue(!second.isCancelled, "second was cancelled")
104+
XCTAssertFalse(first.isCancelled, "first was cancelled")
105+
XCTAssertFalse(second.isCancelled, "second was cancelled")
106106
XCTAssertTrue(third.isCancelled, "third wasn't cancelled")
107107
XCTAssertTrue(fourth.isCancelled, "fourth wasn't cancelled")
108108
}

0 commit comments

Comments
 (0)