moremind commented on code in PR #5659:
URL: https://github.com/apache/shenyu/pull/5659#discussion_r1817866692


##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterDivideServiceImpl.java:
##########
@@ -82,10 +82,14 @@ protected void registerMetadata(final MetaDataRegisterDTO 
dto) {
     protected String buildHandle(final List<URIRegisterDTO> uriList, final 
SelectorDO selectorDO) {
         List<DivideUpstream> addList = buildDivideUpstreamList(uriList);
         List<DivideUpstream> canAddList = new CopyOnWriteArrayList<>();
-        boolean isEventDeleted = uriList.size() == 1 && 
EventType.DELETED.equals(uriList.get(0).getEventType());
+        boolean isEventDeleted = !uriList.isEmpty() && 
EventType.DELETED.equals(uriList.get(0).getEventType());

Review Comment:
   CollectionUtils.isNotEmpty



##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterDivideServiceImpl.java:
##########
@@ -82,10 +82,14 @@ protected void registerMetadata(final MetaDataRegisterDTO 
dto) {
     protected String buildHandle(final List<URIRegisterDTO> uriList, final 
SelectorDO selectorDO) {
         List<DivideUpstream> addList = buildDivideUpstreamList(uriList);
         List<DivideUpstream> canAddList = new CopyOnWriteArrayList<>();
-        boolean isEventDeleted = uriList.size() == 1 && 
EventType.DELETED.equals(uriList.get(0).getEventType());
+        boolean isEventDeleted = !uriList.isEmpty() && 
EventType.DELETED.equals(uriList.get(0).getEventType());
         if (isEventDeleted) {
             addList.get(0).setStatus(false);
         }
+        boolean isEventHeartbeat = !uriList.isEmpty() && 
EventType.HEARTBEAT.equals(uriList.get(0).getEventType());
+        if (isEventHeartbeat) {
+            addList.get(0).setStatus(true);

Review Comment:
   why get(0)



-- 
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: notifications-unsubscr...@shenyu.apache.org

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

Reply via email to