mirror of
https://github.com/DerDavidBohl/dirigent-spring.git
synced 2025-12-30 16:12:13 -06:00
Do not notify on stopped stopped
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user