zhuyanhuazhuyanhua commented on issue #1315:
URL: https://github.com/apache/dubbo-admin/issues/1315#issuecomment-3394320784

   3.流状态实现
   ```go
   package state
   
   import "context"
   
   type ResourceStateFlowManager struct {
        stateStore map[string]*ResourceState
        eventChan  chan ResourceStateEvent
   }
   
   func (m *ResourceStateFlowManager) StartFlow(ctx context.Context) error {
        go m.processStateChanges(ctx)
        return nil
   }
   
   func (m *ResourceStateFlowManager) processStateChanges(ctx context.Context) {
        for {
                select {
                case event := <-m.eventChan:
                        m.updateResourceState(event)
                case <-ctx.Done():
                        return
                }
        }
   }
   ```


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