cq.uuid,
cq.task_type as taskType,
cq.component_uuid as componentUuid,
cq.entity_uuid as entityUuid,
cq.status as status,
cq.submitter_uuid as submitterUuid,
cq.worker_uuid as workerUuid,
cq.started_at as startedAt,
cq.created_at as createdAt,
cq.updated_at as updatedAt
order by
cq.created_at asc,
cq.uuid asc
order by
cq.created_at desc,
cq.uuid desc
from
ce_queue cq
and cq.entity_uuid in
#{entityUuid,jdbcType=VARCHAR}
and cq.status in
#{status,jdbcType=VARCHAR}
and cq.task_type=#{query.type,jdbcType=VARCHAR}
and cq.created_at >= #{query.minSubmittedAt,jdbcType=BIGINT}
cq.uuid as "uuid",
cq.created_at as "created_at"
from
ce_queue cq
left join components c on c.uuid = cq.entity_uuid and c.qualifier <> 'VW'
left join ce_queue cq2 on cq.entity_uuid=cq2.entity_uuid and cq2.status <>'PENDING'
where
cq.status='PENDING'
and cq.started_at is null
and cq2.uuid is null
and cq.task_type <> 'ISSUE_SYNC'
order by
cq.created_at asc,
cq.uuid asc
insert into ce_queue
(
uuid,
task_type,
component_uuid,
entity_uuid,
status,
submitter_uuid,
worker_uuid,
execution_count,
created_at,
updated_at,
started_at
)
values (
#{uuid,jdbcType=VARCHAR},
#{taskType,jdbcType=VARCHAR},
#{componentUuid,jdbcType=VARCHAR},
#{entityUuid,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR},
#{submitterUuid,jdbcType=VARCHAR},
#{workerUuid,jdbcType=VARCHAR},
0,
#{createdAt,jdbcType=BIGINT},
#{updatedAt,jdbcType=BIGINT},
#{startedAt,jdbcType=BIGINT}
)
update ce_queue set
status='PENDING',
updated_at=#{updatedAt,jdbcType=BIGINT}
where
uuid = #{uuid,jdbcType=VARCHAR}
update ce_queue set
status=#{new.status,jdbcType=VARCHAR},
worker_uuid=#{new.workerUuid,jdbcType=VARCHAR},
started_at=#{new.startedAt,jdbcType=BIGINT},
updated_at=#{new.updatedAt,jdbcType=BIGINT}
where
uuid=#{uuid,jdbcType=VARCHAR}
and status=#{old.status,jdbcType=VARCHAR}
delete from
ce_queue
where
uuid=#{uuid,jdbcType=VARCHAR}
and status = #{deleteIf.expectedStatus,jdbcType=VARCHAR}
update ce_queue set
status='PENDING',
worker_uuid=NULL,
updated_at=#{updatedAt,jdbcType=BIGINT}
where
status = 'IN_PROGRESS'
and (
worker_uuid is NULL
or worker_uuid not in
#{workerUUID,jdbcType=VARCHAR}
)
update ce_queue set
status='PENDING',
worker_uuid=NULL,
updated_at=#{updatedAt,jdbcType=BIGINT}
where
status = 'IN_PROGRESS'
select
case when exists
(
select cq.uuid from ce_queue cq where cq.task_type = 'ISSUE_SYNC' and status in ('IN_PROGRESS', 'PENDING')
)
then 1
else 0
end
cq.uuid as ceTaskUuid,
cq.entity_uuid as entityUuid,
cq.component_uuid as componentUuid,
cq.created_at as createdAt,
cq.task_type as taskType,
coalesce(ctc.kee, 'branch') as branchType
from
ce_queue cq
left join ce_task_characteristics ctc on cq.uuid = ctc.task_uuid and (ctc.kee = 'branch' or ctc.kee = 'pullRequest')
where
cq.status = 'PENDING'
and cq.task_type = 'REPORT'
order by
cq.created_at, cq.uuid