robocanic commented on code in PR #1340:
URL: https://github.com/apache/dubbo-admin/pull/1340#discussion_r2450145676


##########
pkg/core/runtime/runtime.go:
##########
@@ -115,13 +116,26 @@ func (rt *runtime) Add(components ...Component) {
 func (rt *runtime) Start(stop <-chan struct{}) error {
        components := maputil.Values(rt.components)
        slice.SortBy(components, func(a, b Component) bool {
-               return a.Order() < b.Order()
+               return a.Order() > b.Order()
        })
        for _, com := range components {
-               err := com.Start(rt, stop)
-               if err != nil {
-                       return err
-               }
+               go func() {
+                       err := com.Start(rt, stop)
+                       if err != nil {
+                               // if a core component failed to start, panic
+                               if slice.Contain(CoreComponentTypes, 
com.Type()) {
+                                       panic("core component " + com.Type() + 
" running failed with error: " + err.Error())
+                               } else {
+                                       logger.Errorf("component %s running 
failed with error: %s", com.Type(), err.Error())
+                               }
+                       } else {
+                               logger.Infof("component %s started 
successfully", com.Type())
+                       }

Review Comment:
   already sort the components in order



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to