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

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

Open
xinsight opened this issue Aug 30, 2017 · 2 comments
Open

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

xinsight opened this issue Aug 30, 2017 · 2 comments
Labels

Comments

@xinsight
Copy link

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?

@saidsikira saidsikira added the bug label Aug 31, 2017
@saidsikira
Copy link
Owner

Hi @xinsight, I'm looking into it.

@zykloman
Copy link

Hi @Arikis, what is the current state of this issue? Any insights? I'm experimenting with the current swift4 branch (bd7550b) and can see a similar behaviour (Xcode 9, iOS 11).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants