Skip to content

internal pending count out of sync #203

@ZhangHanwen96

Description

@ZhangHanwen96

Lets say I have a queue for 10 tasks,
I want to set it to pending if q.concurrency <= q.pending, before q.add(someTask),

But due to the internal implemetation of 'add()' method, the intertal pending++ got executed in the end of current eventloop, so when I do

items.forEach(item => {
   if(q.concurrency <= q.pending) {
            // set item pending
   } else { 
           // set item loading
   }
})

the current q.pending is not what I expected

Helps appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions