This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new b37fa28  Fix some bugs in publishMetadata command (#7903)
b37fa28 is described below

commit b37fa28eec6e15a24a71b3136b61df2dbbf01c9a
Author: 灼华 <[email protected]>
AuthorDate: Mon May 31 10:06:30 2021 +0800

    Fix some bugs in publishMetadata command (#7903)
    
    * Fix the bug that publishMetadata cmd does not work
    
    * Adjust the delay schedule and time unit
    
    1.Delay scheduling should be used instead of scheduled scheduling
    2.The delay unit should be seconds, not milliseconds
---
 .../java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java   | 6 +++++-
 .../java/org/apache/dubbo/qos/command/impl/PublishMetadata.java     | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java
 
b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java
index 342f256..e499e13 100644
--- 
a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java
+++ 
b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java
@@ -17,13 +17,17 @@
 package org.apache.dubbo.qos.command;
 
 import org.apache.dubbo.common.extension.ExtensionLoader;
+import org.apache.dubbo.common.utils.StringUtils;
+
+import static 
org.apache.dubbo.common.constants.CommonConstants.PROPERTIES_CHAR_SEPARATOR;
 
 public class DefaultCommandExecutor implements CommandExecutor {
     @Override
     public String execute(CommandContext commandContext) throws 
NoSuchCommandException {
         BaseCommand command = null;
         try {
-            command = 
ExtensionLoader.getExtensionLoader(BaseCommand.class).getExtension(commandContext.getCommandName());
+            String extName = 
StringUtils.camelToSplitName(commandContext.getCommandName(), 
PROPERTIES_CHAR_SEPARATOR);
+            command = 
ExtensionLoader.getExtensionLoader(BaseCommand.class).getExtension(extName);
         } catch (Throwable throwable) {
                 //can't find command
         }
diff --git 
a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/PublishMetadata.java
 
b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/PublishMetadata.java
index 990854c..1e54e19 100644
--- 
a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/PublishMetadata.java
+++ 
b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/PublishMetadata.java
@@ -51,7 +51,7 @@ public class PublishMetadata implements BaseCommand {
             int delay = Integer.parseInt(args[0]);
             if (future == null || future.isDone() || future.isCancelled()) {
                 future = executorRepository.nextScheduledExecutor()
-                        
.scheduleWithFixedDelay(ServiceInstanceMetadataUtils::refreshMetadataAndInstance,
 0, delay, TimeUnit.MILLISECONDS);
+                        
.schedule(ServiceInstanceMetadataUtils::refreshMetadataAndInstance,  delay, 
TimeUnit.SECONDS);
             }
         } catch (NumberFormatException e) {
             logger.error("Wrong delay param", e);

Reply via email to