Skip to content

Commit

Permalink
set "lastStartedAt" and "lastStoppedAt" initial values
Browse files Browse the repository at this point in the history
  • Loading branch information
WangLiNaruto committed Feb 6, 2024
1 parent 3d0d655 commit d2b0b5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.eclipse.xpanse.modules.deployment;

import jakarta.annotation.Resource;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -51,6 +52,7 @@ public DeployServiceEntity updateDeployServiceEntityWithDeployResult(
log.info("Deploy task update deploy service entity with id:{}", deployResult.getId());
DeployServiceEntity deployServiceEntityToStore = new DeployServiceEntity();
BeanUtils.copyProperties(storedEntity, deployServiceEntityToStore);
deployServiceEntityToStore.setLastStartedAt(OffsetDateTime.now());
updateEntityWithDeployResult(deployResult, deployServiceEntityToStore);
return deployServiceEntityHandler.storeAndFlush(deployServiceEntityToStore);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public DeployedService restartService(UUID id) {
deployServiceEntity.setServiceState(ServiceState.STARTING);
deployServiceEntityHandler.storeAndFlush(deployServiceEntity);
if (restart(deployServiceEntity)) {
deployServiceEntity.setLastStartedAt(OffsetDateTime.now());
deployServiceEntity.setServiceState(ServiceState.RUNNING);
} else {
deployServiceEntity.setServiceState(ServiceState.STARTING_FAILED);
Expand Down

0 comments on commit d2b0b5b

Please sign in to comment.