1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-28 03:57:02 +02:00
Windfarer 0ec3ff0b46
refactor: move plugins to contrib dir (#1399)
* move to contrib dir


Co-authored-by: chenzhihui <zhihui_chen@foxmail.com>
2021-09-01 13:40:14 +08:00

28 lines
447 B
Go

package consul
import (
"sync"
"sync/atomic"
"github.com/go-kratos/kratos/v2/registry"
)
type serviceSet struct {
serviceName string
watcher map[*watcher]struct{}
services *atomic.Value
lock sync.RWMutex
}
func (s *serviceSet) broadcast(ss []*registry.ServiceInstance) {
s.services.Store(ss)
s.lock.RLock()
defer s.lock.RUnlock()
for k := range s.watcher {
select {
case k.event <- struct{}{}:
default:
}
}
}