private boolean scheduleRolloutGroup(final JpaRollout rollout, final JpaRolloutGroup group) {
        final long targetsInGroup = rolloutTargetGroupRepository.countByRolloutGroup(group);
        final long countOfActions = actionRepository.countByRolloutAndRolloutGroup(rollout, group);

        long actionsLeft = targetsInGroup - countOfActions;
        if (actionsLeft > 0) {
            actionsLeft -= createActionsForRolloutGroup(rollout, group);
        }

        if (actionsLeft <= 0) {
            group.setStatus(RolloutGroupStatus.SCHEDULED);
            rolloutGroupRepository.save(group);
            return true;
        }
        return false;
    }
private boolean scheduleRolloutGroup ( final JpaRollout rollout , final JpaRolloutGroup group ) { final long targetsInGroup = rolloutTargetGroupRepository . countByRolloutGroup ( group ) ; final long countOfActions = actionRepository . countByRolloutAndRolloutGroup ( rollout , group ) ; long actionsLeft = targetsInGroup - countOfActions ; if ( actionsLeft > 0 ) { actionsLeft -= createActionsForRolloutGroup ( rollout , group ) ; } if ( actionsLeft <= 0 ) { group . setStatus ( RolloutGroupStatus . SCHEDULED ) ; rolloutGroupRepository . save ( group ) ; return true ; } return false ; }
Schedules a group of the rollout. Scheduled Actions are created to
achieve this. The creation of those Actions is allowed to fail.