From 7482fe57eb37ed156d53749d8d57a8d3367a470a Mon Sep 17 00:00:00 2001 From: Sergey Nuyanzin Date: Wed, 17 Jan 2024 14:37:18 +0100 Subject: [PATCH] Calculate statusTime only when it is required for updateLatestStatus Signed-off-by: Sergey Nuyanzin --- core/src/main/java/io/aiven/klaw/helpers/UtilMethods.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/io/aiven/klaw/helpers/UtilMethods.java b/core/src/main/java/io/aiven/klaw/helpers/UtilMethods.java index 0e15bb8fc3..8920e45019 100644 --- a/core/src/main/java/io/aiven/klaw/helpers/UtilMethods.java +++ b/core/src/main/java/io/aiven/klaw/helpers/UtilMethods.java @@ -92,11 +92,11 @@ public static void updateEnvStatus( public static void updateLatestStatus( ClusterStatus clusterStatus, ManageDatabase manageDatabase, int tenantId, int envId) { - LocalDateTime statusTime = LocalDateTime.now(ZoneOffset.UTC); Optional opt = manageDatabase.getEnv(tenantId, envId); if (opt.isPresent()) { Env e = opt.get(); + final LocalDateTime statusTime = LocalDateTime.now(ZoneOffset.UTC); e.setEnvStatus(clusterStatus); e.setEnvStatusTime(statusTime); e.setEnvStatusTimeString(DATE_TIME_DDMMMYYYY_HHMMSS_FORMATTER.format(statusTime));