diff --git a/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java b/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java index 744e654706c..02e0d0784ef 100644 --- a/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java +++ b/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java @@ -125,10 +125,9 @@ public class LicensesService extends AbstractLifecycleComponent if (newLicenseSignatures.size() != licensesWrapper.signatures.size()) { LicensesMetaData newLicensesMetaData = new LicensesMetaData(newLicenseSignatures, licensesWrapper.encodedTrialLicenses); mdBuilder.putCustom(LicensesMetaData.TYPE, newLicensesMetaData); - } else { - mdBuilder.putCustom(LicensesMetaData.TYPE, currentLicenses); + return ClusterState.builder(currentState).metaData(mdBuilder).build(); } - return ClusterState.builder(currentState).metaData(mdBuilder).build(); + return currentState; } }); } else { @@ -284,10 +283,9 @@ public class LicensesService extends AbstractLifecycleComponent final LicensesMetaData newLicensesMetaData = new LicensesMetaData( licensesWrapper.signatures, newTrialLicenses); mdBuilder.putCustom(LicensesMetaData.TYPE, newLicensesMetaData); - } else { - mdBuilder.putCustom(LicensesMetaData.TYPE, currentLicensesMetaData); + return ClusterState.builder(currentState).metaData(mdBuilder).build(); } - return ClusterState.builder(currentState).metaData(mdBuilder).build(); + return currentState; } @Override