Skip to content

Commit 5a3e9fe

Browse files
authored
Update IndexLifecycleExplainResponse.java
Fix comments; follow DRY for getAge(nowSupplier) call in IndexLifecycleExplainResponse
1 parent 1d89b12 commit 5a3e9fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleExplainResponse.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
8484
Objects.requireNonNullElse((Boolean) a[22], false)
8585
// a[13] == "age"
8686
// a[20] == "time_since_index_creation"
87+
// a[23] = "age_in_millis"
8788
)
8889
);
8990
static {
@@ -531,8 +532,10 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
531532
LIFECYCLE_DATE_FIELD.getPreferredName(),
532533
lifecycleDate
533534
);
534-
builder.field(AGE_FIELD.getPreferredName(), getAge(nowSupplier).toHumanReadableString(2));
535-
builder.field(AGE_IN_MILLIS_FIELD.getPreferredName(), getAge(nowSupplier).getMillis());
535+
536+
final TimeValue ageNow = getAge(nowSupplier);
537+
builder.field(AGE_FIELD.getPreferredName(), ageNow.toHumanReadableString(2));
538+
builder.field(AGE_IN_MILLIS_FIELD.getPreferredName(), ageNow.getMillis());
536539
}
537540
if (phase != null) {
538541
builder.field(PHASE_FIELD.getPreferredName(), phase);

0 commit comments

Comments
 (0)