diff --git a/registry/directory/directory.go b/registry/directory/directory.go index 79c90c1ceb1f7551d43ec6ba51dd7a1caf983f1b..960855bc3c322341823d8b61045a9abe5d299c4f 100644 --- a/registry/directory/directory.go +++ b/registry/directory/directory.go @@ -128,7 +128,7 @@ func (dir *RegistryDirectory) refreshInvokers(events ...*registry.ServiceEvent) var oldInvokers []protocol.Invoker // in batch mode, it is safe to remove since we have the complete list of events. - if events != nil && len(events) > 1 { + if len(events) > 1 { dir.cacheInvokersMap.Range(func(k, v interface{}) bool { if !dir.eventMatched(k.(string), events) { if invoker := dir.uncacheInvokerWithKey(k.(string)); invoker != nil { @@ -145,7 +145,7 @@ func (dir *RegistryDirectory) refreshInvokers(events ...*registry.ServiceEvent) } } - if events != nil && len(events) > 0 { + if len(events) > 0 { dir.setNewInvokers() } diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go index 00283a117c0e3727f0c5beb190bd7f4527c2c5d4..d313e482a7c945e15e8431ecc10461ec757268db 100644 --- a/registry/protocol/protocol.go +++ b/registry/protocol/protocol.go @@ -243,7 +243,7 @@ func newOverrideSubscribeListener(overriderUrl *common.URL, invoker protocol.Inv // Notify will be triggered when a service change notification is received. func (nl *overrideSubscribeListener) Notify(events ...*registry.ServiceEvent) { - if events == nil || len(events) == 0 { + if len(events) == 0 { return }