Browse Source

add self filer

pull/1455/head
Chris Lu 4 years ago
parent
commit
30dc365cbd
  1. 9
      weed/filer/filer.go

9
weed/filer/filer.go

@ -62,9 +62,16 @@ func NewFiler(masters []string, grpcDialOption grpc.DialOption,
func (f *Filer) AggregateFromPeers(self string, filers []string) { func (f *Filer) AggregateFromPeers(self string, filers []string) {
// set peers // set peers
if len(filers) == 0 {
found := false
for _, peer := range filers {
if peer == self {
found = true
}
}
if !found {
filers = append(filers, self) filers = append(filers, self)
} }
f.MetaAggregator = NewMetaAggregator(filers, f.GrpcDialOption) f.MetaAggregator = NewMetaAggregator(filers, f.GrpcDialOption)
f.MetaAggregator.StartLoopSubscribe(f, self) f.MetaAggregator.StartLoopSubscribe(f, self)

Loading…
Cancel
Save