Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

maxConcurrentCount=1 only executes the first task in the queue #18

@xinsight

Description

@xinsight

Overdrive: 0.3
Package manager (SPM, Carthage, CocoaPods, Manual): n/a
Xcode: 8.3.2 (macOS 10.12.5)
Platform: iOS

When TaskQueue.maximumConcurrentTaskCount = 1`, only one task is executed. (The 2nd task is not executed.)

Here is a test case that indicates the issue.

    func testTwoTaskShouldBothCompleteWhenMaxConcurrentTaskCountIsOne() {

        queue.maxConcurrentTaskCount = 1

        let expectation1 = self.expectation(description: "a")
        let expectation2 = self.expectation(description: "b")

        let task = anyTask(withResult: .value(1))
        task.onValue { _ in
            expectation1.fulfill()
        }
        let task2 = anyTask(withResult: .value(1))
        task2.onValue { _ in
            expectation2.fulfill()
        }
        queue.add(task: task)
        queue.add(task: task2)

        waitForExpectations(timeout: 5)

    }

The test fails as the "b" expectation is unfulfilled. Any ideas what could be wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions