[ISSUES #281 #274 #285 #287] Speeds up topic and consumer queries, adds caching, and fixes delay/dead-letter topic mix-up (#286)

* fix: Resolved issue of query failure under a large number of topics and consumers apache#281

* fix: Expand the message ID query time range to avoid query failure

* fix: Remove duplicates from topic queries, increase system topic recognition #287
This commit is contained in:
Xu Yichi
2025-04-13 19:41:24 +08:00
committed by GitHub
parent e76185437f
commit bbabd1cd0d
16 changed files with 464 additions and 160 deletions

View File

@@ -70,6 +70,34 @@ module.controller('consumerController', ['$scope', 'ngDialog', '$http', 'Notific
}
$scope.filterList($scope.paginationConf.currentPage)
};
$scope.refreshConsumerGroup = function (groupName) {
//Show loader
$('#loaderConsumer').removeClass("hide-myloader");
$http({
method: "GET",
url: "/consumer/group.refresh",
params: {
address: $scope.isRmqVersionV5() ? localStorage.getItem('proxyAddr') : null,
consumerGroup: groupName
}
}).success(function (resp) {
if (resp.status == 0) {
for (var i = 0; i < $scope.allConsumerGrouopList.length; i++) {
if ($scope.allConsumerGrouopList[i].group === groupName) {
$scope.allConsumerGrouopList[i] = resp.data;
break;
}
}
$scope.showConsumerGroupList($scope.paginationConf.currentPage, $scope.allConsumerGrouopList.length);
//Hide loader
$('#loaderConsumer').addClass("hide-myloader");
} else {
Notification.error({message: resp.errMsg, delay: 2000});
}
});
}
$scope.refreshConsumerData = function () {
//Show loader
$('#loaderConsumer').removeClass("hide-myloader");
@@ -421,4 +449,4 @@ module.controller('consumerTopicViewDialogController', ['$scope', 'ngDialog', '$
});
};
}]
);
);

View File

@@ -135,4 +135,5 @@ var en = {
"MESSAGE_TYPE_FIFO": "FIFO",
"MESSAGE_TYPE_DELAY": "DELAY",
"MESSAGE_TYPE_TRANSACTION": "TRANSACTION",
"UPDATE_TIME": "Update Time",
}

View File

@@ -136,4 +136,5 @@ var zh = {
"MESSAGE_TYPE_FIFO": "顺序消息",
"MESSAGE_TYPE_DELAY": "定时/延时消息",
"MESSAGE_TYPE_TRANSACTION": "事务消息",
}
"UPDATE_TIME": "更新时间",
}

View File

@@ -277,4 +277,4 @@ module.controller('messageDetailViewDialogController', ['$scope', 'ngDialog', '$
$scope.messageTrackShowList = canShowList;
});
}]
);
);

View File

@@ -59,7 +59,7 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http', 'Notificati
$scope.userRole = $window.sessionStorage.getItem("userrole");
$scope.writeOperationEnabled = $scope.userRole == null ? true : ($scope.userRole == 1 ? true : false);
$scope.refreshTopicList = function () {
$scope.getTopicList = function () {
$http({
method: "GET",
url: "topic/list.queryTopicType"
@@ -77,7 +77,34 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http', 'Notificati
});
};
$scope.refreshTopicList();
$scope.refreshTopicList = function () {
$http({
method: "POST",
url: "topic/refresh"
}).success(function (resp) {
if (resp.status == 0 && resp.data == true) {
$http({
method: "GET",
url: "topic/list.queryTopicType"
}).success(function (resp1) {
if (resp1.status == 0) {
$scope.allTopicNameList = resp1.data.topicNameList;
$scope.allMessageTypeList = resp1.data.messageTypeList;
console.log($scope.allTopicNameList);
console.log(JSON.stringify(resp1));
$scope.showTopicList(1, $scope.allTopicNameList.length);
} else {
Notification.error({message: resp1.errMsg, delay: 5000});
}
});
} else {
Notification.error({message: resp.errMsg, delay: 5000});
}
});
};
$scope.getTopicList();
$scope.filterStr = "";
$scope.$watch('filterStr', function () {
@@ -127,17 +154,17 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http', 'Notificati
$scope.filterByType = function (str, type) {
if ($scope.filterRetry) {
if (str.startsWith("%R")) {
if (type.includes("RETRY")) {
return true
}
}
if ($scope.filterDLQ) {
if (str.startsWith("%D")) {
if (type.includes("DLQ")) {
return true
}
}
if ($scope.filterSystem) {
if (str.startsWith("%S")) {
if (type.includes("SYSTEM")) {
return true
}
}
@@ -386,10 +413,6 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http', 'Notificati
if (resp.status == 0) {
console.log(resp);
ngDialog.open({
preCloseCallback: function (value) {
// Refresh topic list
$scope.refreshTopicList();
},
template: 'topicModifyDialog',
controller: 'topicModifyDialogController',
data: {
@@ -540,4 +563,4 @@ module.controller('routerViewDialogController', ['$scope', 'ngDialog', '$http',
})
};
}]
);
);

View File

@@ -33,9 +33,6 @@
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-show="{{writeOperationEnabled}}"
ng-click="openAddDialog()">{{'ADD' | translate}}/ {{'UPDATE' | translate}}
</button>
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="refreshConsumerData()">
{{'REFRESH' | translate}}
</button>
<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" ng-model="intervalProcessSwitch">
{{'AUTO_REFRESH' | translate}}
</md-switch>
@@ -53,6 +50,7 @@
<th class="text-center">{{ 'MODE' | translate}}</th>
<th class="text-center"><a ng-click="sortByKey('consumeTps')">TPS</a></th>
<th class="text-center"><a ng-click="sortByKey('diffTotal')">{{ 'DELAY' | translate}}</a></th>
<th class="text-center">{{ 'UPDATE_TIME' | translate}}</th>
<th class="text-center">{{ 'OPERATION' | translate}}</th>
</tr>
<tr ng-repeat="consumerGroup in consumerGroupShowList"
@@ -65,6 +63,7 @@
<td class="text-center">{{consumerGroup.messageModel}}</td>
<td class="text-center">{{consumerGroup.consumeTps}}</td>
<td class="text-center">{{consumerGroup.diffTotal}}</td>
<td class="text-center">{{consumerGroup.updateTime}}</td>
<td class="text-left">
<button name="client" ng-click="client(consumerGroup.group, consumerGroup.address)"
class="btn btn-raised btn-sm btn-primary"
@@ -85,6 +84,9 @@
ng-show="{{!sysFlag && writeOperationEnabled}}"
type="button">{{'DELETE' | translate}}
</button>
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="refreshConsumerGroup(consumerGroup.group)">
{{'REFRESH' | translate}}
</button>
</td>
</tr>
@@ -568,4 +570,4 @@
</div>
</div>
</div>
</script>
</script>