Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
serialQueue wasn't actually serial
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Mar 10, 2020
1 parent 1cf013d commit d38bb3b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion OperationPlus/Extensions/OperationQueue+Creation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ extension OperationQueue {
}

public static func serialQueue(named name: String) -> OperationQueue {
return OperationQueue(name: name)
return OperationQueue(name: name, maxConcurrentOperations: 1)
}
}
4 changes: 2 additions & 2 deletions OperationPlus/OperationPlus.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
PRODUCT_NAME = OperationPlus
PRODUCT_BUNDLE_IDENTIFIER = com.chimehq.OperationPlus
PRODUCT_MODULE_NAME = OperationPlus
CURRENT_PROJECT_VERSION = 8
MARKETING_VERSION = 1.5.0
CURRENT_PROJECT_VERSION = 9
MARKETING_VERSION = 1.5.1

INFOPLIST_FILE = OperationPlus/Info.plist

Expand Down
13 changes: 13 additions & 0 deletions OperationPlusTests/OperationQueueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ import OperationTestingPlus
@testable import OperationPlus

class OperationQueueTests: XCTestCase {
func testSerialCreation() {
let queue = OperationQueue.serialQueue()

XCTAssertEqual(queue.maxConcurrentOperationCount, 1)
}

func testNamedSerialCreation() {
let queue = OperationQueue.serialQueue(named: "myqueue")

XCTAssertEqual(queue.name, "myqueue")
XCTAssertEqual(queue.maxConcurrentOperationCount, 1)
}

func testDependencies() {
let opA = Operation()
let opB = Operation()
Expand Down

0 comments on commit d38bb3b

Please sign in to comment.