You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/12/26 14:08:54 UTC

[GitHub] [rocketmq-clients] colprog commented on a diff in pull request #324: dotnet driver: Fix message queue handling

colprog commented on code in PR #324:
URL: https://github.com/apache/rocketmq-clients/pull/324#discussion_r1057252306


##########
csharp/rocketmq-client-csharp/SimpleConsumer.cs:
##########
@@ -196,12 +196,13 @@ internal override void OnSettingsReceived(rmq.Settings settings)
             }
         }
 
-        public async Task<List<Message>> Receive(int batchSize, TimeSpan invisibleDuration)
+        public async Task<List<Message>> Receive(int batchSize, TimeSpan invisibleDuration, TimeSpan? awaitDuration = null)
         {
             var messageQueue = NextQueue();
             if (null == messageQueue)
             {
-                Logger.Debug("NextQueue returned null");
+                Logger.Debug("NextQueue returned null, waiting for 50ms");
+                await Task.Delay(50);

Review Comment:
   If we start the consumer without any topics. a receive loop became a busy loop with no yield point. this will saturate a client thread and takes up server resources.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org