Do not notify on stopped stopped

This commit is contained in:
DerDavidBohl
2025-09-29 16:14:30 +02:00
parent eae6467b75
commit 2771aeb75b
2 changed files with 14 additions and 3 deletions

View File

@@ -33,8 +33,8 @@ public class DeploymentsController {
}
@PostMapping("/{name}/start")
public void startDeployment(@PathVariable String name, @RequestParam(required = false) boolean force) {
applicationEventPublisher.publishEvent(new NamedDeploymentStartRequestedEvent(this, name, force));
public void startDeployment(@PathVariable String name, @RequestParam(required = false) boolean forceRecreate) {
applicationEventPublisher.publishEvent(new NamedDeploymentStartRequestedEvent(this, name, forceRecreate));
}
@PostMapping("/{name}/stop")

View File

@@ -202,7 +202,18 @@ public class DeploymentsService {
private void stopDeployment(String deploymentName) throws InterruptedException, IOException {
logger.info("Stopping deployment {}", deploymentName);
applicationEventPublisher.publishEvent(new DeploymentStateEvent(this, deploymentName, DeploymentState.State.STOPPING, "Stopping deployment '%s'".formatted(deploymentName)));
Optional<DeploymentState> optionalState= deploymentStatePersistingService.getDeploymentStates().stream()
.filter(state -> state.getName().equals(deploymentName))
.findFirst();
boolean stopWouldChangeState = optionalState.isEmpty() || optionalState.get().getState() != DeploymentState.State.STOPPED;
if(stopWouldChangeState) {
applicationEventPublisher.publishEvent(new DeploymentStateEvent(this, deploymentName, DeploymentState.State.STOPPING, "Stopping deployment '%s'".formatted(deploymentName)));
}
List<String> commandArgs = new ArrayList<>(Arrays.stream(composeCommand.split(" ")).toList());
commandArgs.add("down");
new ProcessBuilder(commandArgs)