Skip to content

Commit

Permalink
Calculate statusTime only when it is required for updateLatestStatus
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey Nuyanzin <[email protected]>
  • Loading branch information
snuyanzin authored Jan 17, 2024
1 parent b8108ce commit 7482fe5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/io/aiven/klaw/helpers/UtilMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Env> 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));
Expand Down

0 comments on commit 7482fe5

Please sign in to comment.