Fix double write NPE (#4886)

This commit is contained in:
杨翊 SionYang 2021-02-05 14:02:24 +08:00 committed by GitHub
parent 8dfaabdaf3
commit 3af5c03c52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,15 +104,17 @@ public class ServiceChangeV1Task extends AbstractDelayTask {
serviceTask.getContent());
ServiceManager serviceManager = ApplicationUtils.getBean(ServiceManager.class);
Service service = serviceManager.getService(serviceTask.getNamespace(), serviceTask.getServiceName());
switch (serviceTask.getContent()) {
case METADATA:
dispatchMetadataTask(service, serviceTask.isEphemeral());
break;
case INSTANCE:
dispatchInstanceTask(service, serviceTask.isEphemeral());
break;
default:
dispatchAllTask(service, serviceTask.isEphemeral());
if (null != service) {
switch (serviceTask.getContent()) {
case METADATA:
dispatchMetadataTask(service, serviceTask.isEphemeral());
break;
case INSTANCE:
dispatchInstanceTask(service, serviceTask.isEphemeral());
break;
default:
dispatchAllTask(service, serviceTask.isEphemeral());
}
}
return true;
}