Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent::Collection::RubyNonConcurrentPriorityQueue#delete works wrong #872

Closed
bolshakov opened this issue May 27, 2020 · 0 comments · Fixed by #905
Closed

Concurrent::Collection::RubyNonConcurrentPriorityQueue#delete works wrong #872

bolshakov opened this issue May 27, 2020 · 0 comments · Fixed by #905
Labels
bug A bug in the library or documentation.

Comments

@bolshakov
Copy link
Contributor

bolshakov commented May 27, 2020

* Operating system:                mac
* Ruby implementation:             Ruby
* `concurrent-ruby` version:       master

Here is the test case:

def dequeue_all(queue)
  queue.size.times.inject([]) do |acc, _|
    acc << queue.pop
  end
end

queue = described_class.from_list([2, 1, 2, 0, 1, 1, 2], order: :max)

queue.delete(0)

expect(dequeue_all(queue)).to eq([2, 2, 2, 1, 1, 1])

It fails with the following error:

       expected: [2, 2, 2, 1, 1, 1]
            got: [2, 2, 1, 2, 1, 1]

As you can see it does not maintain the oredr after removing an element in some cases.

@pitr-ch pitr-ch added the bug A bug in the library or documentation. label Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in the library or documentation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants