Skip to content

Commit

Permalink
Fix change instance metadata, the revision of service not change.
Browse files Browse the repository at this point in the history
  • Loading branch information
KomachiSion committed Jul 19, 2022
1 parent 014161a commit a20cfe2
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.alibaba.nacos.consistency.entity.WriteRequest;
import com.alibaba.nacos.consistency.snapshot.SnapshotOperation;
import com.alibaba.nacos.core.distributed.ProtocolManager;
import com.alibaba.nacos.naming.core.v2.ServiceManager;
import com.alibaba.nacos.naming.core.v2.event.service.ServiceEvent;
import com.alibaba.nacos.naming.core.v2.pojo.Service;
import com.alibaba.nacos.naming.constants.Constants;
Expand Down Expand Up @@ -102,12 +103,14 @@ public Response onApply(WriteRequest request) {

private void updateInstanceMetadata(MetadataOperation<InstanceMetadata> op) {
Service service = Service.newService(op.getNamespace(), op.getGroup(), op.getServiceName());
service = ServiceManager.getInstance().getSingleton(service);
namingMetadataManager.updateInstanceMetadata(service, op.getTag(), op.getMetadata());
NotifyCenter.publishEvent(new ServiceEvent.ServiceChangedEvent(service, true));
}

private void deleteInstanceMetadata(MetadataOperation<InstanceMetadata> op) {
Service service = Service.newService(op.getNamespace(), op.getGroup(), op.getServiceName());
service = ServiceManager.getInstance().getSingleton(service);
namingMetadataManager.removeInstanceMetadata(service, op.getTag());
}

Expand Down

0 comments on commit a20cfe2

Please sign in to comment.