findPipelinesReadyToFinishForUpdate
@Query(value = "
select
pipeline.id
from task pipeline
join task_type pipeline_type on pipeline_type.id = pipeline.type_id
where
pipeline_type.category = 20 and
pipeline.running_status < 50 and
pipeline.finishing_state is not null and
not exists (
select 1
from task child
join task_type child_type on child_type.id = child.type_id
where
child.pipeline_task_id = pipeline.id and
child_type.category = 10 and
child.running_status < 50
)
order by
pipeline.id
for update of pipeline skip locked
", nativeQuery = true)