From d3d8a2383f2b2a64ac948f1dda08d7b391484cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=9D=E5=8D=81=E6=9B=BF=20=E9=99=88=E4=B8=BD=E8=99=B9?= Date: Thu, 14 Mar 2024 19:09:01 +0800 Subject: [PATCH] fix actor fails to recive batching messages if batchsize is less than the number of messages in the batchingMailbox because of dead loop --- src/Proto.Actor/Mailbox/BatchingMailbox.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Proto.Actor/Mailbox/BatchingMailbox.cs b/src/Proto.Actor/Mailbox/BatchingMailbox.cs index ba23070d27..8367d650e2 100644 --- a/src/Proto.Actor/Mailbox/BatchingMailbox.cs +++ b/src/Proto.Actor/Mailbox/BatchingMailbox.cs @@ -79,8 +79,8 @@ private async Task RunAsync() { batch.Clear(); - while ((msg = _userMessages.Pop()) is not null || - batch.Count >= _batchSize) + while (batch.Count < _batchSize && + (msg = _userMessages.Pop()) is not null) { batch.Add(msg!); }