chickenlj commented on code in PR #2311:
URL: https://github.com/apache/dubbo-go/pull/2311#discussion_r1211180590


##########
metadata/report/zookeeper/report.go:
##########
@@ -89,13 +89,23 @@ func (m *zookeeperMetadataReport) 
PublishAppMetadata(metadataIdentifier *identif
 // StoreProviderMetadata stores the metadata.
 func (m *zookeeperMetadataReport) StoreProviderMetadata(providerIdentifier 
*identifier.MetadataIdentifier, serviceDefinitions string) error {
        k := m.rootDir + providerIdentifier.GetFilePathKey()
-       return m.client.CreateWithValue(k, []byte(serviceDefinitions))
+       err := m.client.CreateWithValue(k, []byte(serviceDefinitions))
+       if err == zk.ErrNodeExists {
+               logger.Debugf("Try to store provider metadata failed. In most 
cases, it's not a problem. ")
+               return nil
+       }
+       return err
 }
 
 // StoreConsumerMetadata stores the metadata.
 func (m *zookeeperMetadataReport) 
StoreConsumerMetadata(consumerMetadataIdentifier 
*identifier.MetadataIdentifier, serviceParameterString string) error {
        k := m.rootDir + consumerMetadataIdentifier.GetFilePathKey()
-       return m.client.CreateWithValue(k, []byte(serviceParameterString))
+       err := m.client.CreateWithValue(k, []byte(serviceParameterString))
+       if err == zk.ErrNodeExists {

Review Comment:
   I suggest use the following method instead
   
   perrors.Is(err, zk.ErrNodeExists)



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