class ScheduledLifetimeChecker {

    @Scheduled(fixedRate = 60 * 1000, initialDelay = 60 * 1000)
    public void validate() {
        stackService.getAllAlive().forEach(stack ->
                stackService.getTtlValueForStack(stack.getId()).ifPresent(ttl -> {
                    if (isInDeletableStatus(stack) && isExceeded(stack.getCreationFinished(), ttl.toMillis())) {
                        LOGGER.info("Stack is exceeded at {}ms because is in deletable status and ttl is expired, ttl: {}",
                                stack.getCreationFinished() + ttl.toMillis(), ttl.toMillis());
                        terminateStack(stack);
                    }
                }));
    }

}