Fix the error in determining the type of deleted metadata

This commit is contained in:
KomachiSion 2020-12-08 17:39:28 +08:00
parent 59f38019a6
commit cd7a2d0ce6

View File

@ -66,13 +66,13 @@ public class ExpiredMetadataCleaner extends AbstractNamingCleaner {
private void removeExpiredMetadata(ExpiredMetadataInfo expiredInfo) { private void removeExpiredMetadata(ExpiredMetadataInfo expiredInfo) {
Loggers.SRV_LOG.info("Remove expired metadata {}", expiredInfo); Loggers.SRV_LOG.info("Remove expired metadata {}", expiredInfo);
if (null == expiredInfo.getInstanceId()) { if (null == expiredInfo.getInstanceId()) {
if (metadataManager.containInstanceMetadata(expiredInfo.getService(), expiredInfo.getInstanceId())) {
metadataOperateService.deleteServiceMetadata(expiredInfo.getService());
}
} else {
if (metadataManager.containServiceMetadata(expiredInfo.getService())) { if (metadataManager.containServiceMetadata(expiredInfo.getService())) {
metadataOperateService.deleteInstanceMetadata(expiredInfo.getService(), expiredInfo.getInstanceId()); metadataOperateService.deleteInstanceMetadata(expiredInfo.getService(), expiredInfo.getInstanceId());
} }
} else {
if (metadataManager.containInstanceMetadata(expiredInfo.getService(), expiredInfo.getInstanceId())) {
metadataOperateService.deleteServiceMetadata(expiredInfo.getService());
}
} }
} }
} }