RockteMQ-AI commented on code in PR #2043:
URL:
https://github.com/apache/rocketmq-dashboard/pull/2043#discussion_r3769322174
##########
server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQMessageProvider.java:
##########
@@ -191,22 +192,20 @@ private List<MessageRecordVO>
queryByKey(DefaultMQAdminExt adminExt, String topi
*/
private List<MessageRecordVO> queryByTopic(String endpoint, String topic,
String tag, long begin, long end, int limit) {
DefaultMQPullConsumer consumer = newPullConsumer("studio-msg-query",
endpoint);
- List<MessageRecordVO> result = new ArrayList<>();
+ int resultLimit = Math.min(limit, TOPIC_QUERY_HARD_CAP);
+ PriorityQueue<MessageRecordVO> newestMessages = new PriorityQueue<>(
+ Comparator.comparingLong(MessageRecordVO::getStoreTime));
try {
Review Comment:
Removing the early-exit (`break outer`) means every queue is now fully
scanned. For topics with a large number of messages this could be significantly
slower than the previous implementation. Consider documenting the trade-off or
adding a per-queue offset budget (e.g. cap the number of offsets scanned per
queue proportionally to `resultLimit / queues.size()`) so that a single hot
queue cannot dominate the scan time.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]