func (s *CBSuite) Close() error {
	if s.servicePanel != nil {
		s.servicePanel.Close()
		s.servicePanel = nil
		s.serviceControl = nil
	}
	if s.instancePanel != nil {
		s.instancePanel.Close()
		s.instancePanel = nil
		s.instanceControl = nil
	}
	return nil
}
Close circuitbreaker.Panel to release associated resources.
package circuitbreak
import (
	"context"
	"fmt"
	"strings"
	"sync"
	"time"
	"github.com/bytedance/gopkg/cloud/circuitbreaker"
	"github.com/cloudwego/kitex/pkg/discovery"
	"github.com/cloudwego/kitex/pkg/endpoint"
	"github.com/cloudwego/kitex/pkg/event"
	"github.com/cloudwego/kitex/pkg/kerrors"
	"github.com/cloudwego/kitex/pkg/rpcinfo"
)
const (
	serviceCBKey  = "service"
	instanceCBKey = "instance"
	cbConfig      = "cb_config"
)
var defaultCBConfig = CBConfig{Enable: true, ErrRate: 0.5, MinSample: 200}
func GetDefaultCBConfig() CBConfig {
	return defaultCBConfig
}
type CBConfig struct {
	Enable    bool    `json:"enable"`
	ErrRate   float64 `json:"err_rate"`
	MinSample int64   `json:"min_sample"`
}
type GenServiceCBKeyFunc func(ri rpcinfo.RPCInfo) string
type instanceCBConfig struct {
	CBConfig
	sync.RWMutex
}
type CBSuite struct {
	servicePanel    circuitbreaker.Panel
	serviceControl  *Control
	instancePanel   circuitbreaker.Panel
	instanceControl *Control
	genServiceCBKey GenServiceCBKeyFunc
	serviceCBConfig sync.Map  
	instanceCBConfig instanceCBConfig
	events event.Queue
}
func NewCBSuite(genKey GenServiceCBKeyFunc) *CBSuite {
	s := &CBSuite{genServiceCBKey: genKey}
	return s
}
func (s *CBSuite) ServiceCBMW() endpoint.Middleware {
	if s == nil {
		return endpoint.DummyMiddleware
	}
	s.initServiceCB()
	return NewCircuitBreakerMW(*s.serviceControl, s.servicePanel)
}
func (s *CBSuite) InstanceCBMW() endpoint.Middleware {
	if s == nil {
		return endpoint.DummyMiddleware
	}
	s.initInstanceCB()
	return NewCircuitBreakerMW(*s.instanceControl, s.instancePanel)
}
func (s *CBSuite) ServicePanel() circuitbreaker.Panel {
	if s.servicePanel == nil {
		s.initServiceCB()
	}
	return s.servicePanel
}
func (s *CBSuite) ServiceControl() *Control {
	if s.serviceControl == nil {
		s.initServiceCB()
	}
	return s.serviceControl
}
func (s *CBSuite) UpdateServiceCBConfig(key string, cfg CBConfig) {
	s.serviceCBConfig.Store(key, cfg)
}
func (s *CBSuite) UpdateInstanceCBConfig(cfg CBConfig) {
	s.instanceCBConfig.Lock()
	s.instanceCBConfig.CBConfig = cfg
	s.instanceCBConfig.Unlock()
}
func (s *CBSuite) SetEventBusAndQueue(bus event.Bus, events event.Queue) {
	s.events = events
	if bus != nil {
		bus.Watch(discovery.ChangeEventName, s.discoveryChangeHandler)
	}
}
func (s *CBSuite) Dump() interface{} {
	return map[string]interface{}{
		serviceCBKey:  cbDebugInfo(s.servicePanel),
		instanceCBKey: cbDebugInfo(s.instancePanel),
		cbConfig:      s.configInfo(),
	}
}