Repository: kestra-io/kestra
File: core/src/main/java/io/kestra/core/runners/FlowableUtils.java (Java)

Code before:
                            .containsAll(taskDependIds);
                })
        );
    }

    public static List<NextTaskRun> resolveParallelNexts(
        Execution execution,
        List<ResolvedTask> tasks,
        List<ResolvedTask> errors,
        List<ResolvedTask> _finally,
        TaskRun parentTaskRun,
        Integer concurrency,
        BiFunction<Stream<NextTaskRun>, List<TaskRun>, Stream<NextTaskRun>> nextTaskRunFunction
    ) {
        if (execution.getState().getCurrent() == State.Type.KILLING) {
            return Collections.emptyList();
        }

        List<ResolvedTask> currentTasks = execution.findTaskDependingFlowState(
            tasks,
            errors,
            _finally,
            parentTaskRun
        );

        List<ResolvedTask> resolvedTasks = execution.findTaskDependingFlowState(tasks);

        boolean isTasks = resolvedTasks.equals(currentTasks);

        // errors & finally must be run as sequential tasks
        if (!isTasks) {
            return resolveSequentialNexts(
                execution,
                tasks,
                errors,
                _finally,
                parentTaskRun
            );
        }

        // all tasks run
        List<TaskRun> taskRuns = execution.findTaskRunByTasks(currentTasks, parentTaskRun);

        // find all running and deal concurrency
        long runningCount = taskRuns
            .stream()
            .filter(taskRun -> taskRun.getState().isRunning())
            .count();

        if (concurrency > 0 && runningCount > concurrency) {
            return Collections.emptyList();

Review comment (suggestion):
```suggestion
        List<ResolvedTask> resolvedTasks = execution.removeDisabled(tasks);
```

They are doing the same but this one is more self-explanatory

Code after:
                            .containsAll(taskDependIds);
                })
        );
    }

    public static List<NextTaskRun> resolveParallelNexts(
        Execution execution,
        List<ResolvedTask> tasks,
        List<ResolvedTask> errors,
        List<ResolvedTask> _finally,
        TaskRun parentTaskRun,
        Integer concurrency,
        BiFunction<Stream<NextTaskRun>, List<TaskRun>, Stream<NextTaskRun>> nextTaskRunFunction
    ) {
        if (execution.getState().getCurrent() == State.Type.KILLING) {
            return Collections.emptyList();
        }

        List<ResolvedTask> currentTasks = execution.findTaskDependingFlowState(
            tasks,
            errors,
            _finally,
            parentTaskRun
        );

        List<ResolvedTask> resolvedTasks = execution.removeDisabled(tasks);

        boolean isTasks = resolvedTasks.equals(currentTasks);

        // errors & finally must be run as sequential tasks
        if (!isTasks) {
            return resolveSequentialNexts(
                execution,
                tasks,
                errors,
                _finally,
                parentTaskRun
            );
        }

        // all tasks run
        List<TaskRun> taskRuns = execution.findTaskRunByTasks(currentTasks, parentTaskRun);

        // find all running and deal concurrency
        long runningCount = taskRuns
            .stream()
            .filter(taskRun -> taskRun.getState().isRunning())
            .count();

        if (concurrency > 0 && runningCount > concurrency) {
            return Collections.emptyList();