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

TestKit ReceiveWhile did not insert last inspected message properly. #5092

Conversation

Arkatufus
Copy link
Contributor

While peeking through items inside the backing BlockingCollection, ReceiveWhile re-insert the last item it inspected in the last position instead of the first.

@@ -22,7 +22,7 @@ namespace Akka.TestKit.Internal
/// <typeparam name="T">The type of item to store.</typeparam>
public class BlockingQueue<T>
{
private readonly BlockingCollection<Positioned> _collection = new BlockingCollection<Positioned>();
private readonly BlockingCollection<Positioned> _collection = new BlockingCollection<Positioned>(new QueueWithAddFirst());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QueueWithAddFirst is the backing IProducerConsumerCollection for the internal BlockingCollection that allows proper item insertion in the head of the queue.

@Arkatufus Arkatufus marked this pull request as ready for review June 14, 2021 16:30
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - looks like we should have been using that positional queue this entire time.

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) June 15, 2021 14:40
@Aaronontheweb Aaronontheweb added this to the 1.4.21 milestone Jun 15, 2021
@Aaronontheweb Aaronontheweb added the akka-testkit Akka.NET Testkit issues label Jun 15, 2021
@Aaronontheweb Aaronontheweb merged commit 456d795 into akkadotnet:dev Jun 15, 2021
@Arkatufus Arkatufus deleted the Fix_ReceiveWhile_did_not_insert_items_properly branch February 27, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
akka-testkit Akka.NET Testkit issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants