added hook for resque
This commit is contained in:
parent
6172d27a7b
commit
5f0938bf06
|
@ -15,10 +15,11 @@ class Api::V1::JobsController < Api::V1::BaseController
|
||||||
oldest.order(:created_at)
|
oldest.order(:created_at)
|
||||||
build_lists = build_lists.for_platform(platform_ids) if platform_ids.present?
|
build_lists = build_lists.for_platform(platform_ids) if platform_ids.present?
|
||||||
if current_user.system?
|
if current_user.system?
|
||||||
# TODO: rollback later
|
@build_list = build_lists.not_owned_external_nodes.first
|
||||||
# @build_list = build_lists.not_owned_external_nodes.first
|
# TODO: Hook for resque, remove later
|
||||||
@build_list = build_lists.external_nodes(:everything).first
|
if @build_list && @build_list.external_nodes.blank? && @build_list.destroy_from_resque_queue != 1
|
||||||
|
@build_list = nil
|
||||||
|
end
|
||||||
@build_list.touch if @build_list
|
@build_list.touch if @build_list
|
||||||
else
|
else
|
||||||
@build_list = build_lists.external_nodes(:owned).for_user(current_user).first
|
@build_list = build_lists.external_nodes(:owned).for_user(current_user).first
|
||||||
|
|
|
@ -29,12 +29,7 @@ module AbfWorker::ModelHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def cancel_job
|
def cancel_job
|
||||||
deleted = Resque::Job.destroy(
|
if destroy_from_resque_queue == 1
|
||||||
worker_queue_with_priority,
|
|
||||||
worker_queue_class,
|
|
||||||
abf_worker_args
|
|
||||||
)
|
|
||||||
if deleted == 1
|
|
||||||
build_canceled
|
build_canceled
|
||||||
else
|
else
|
||||||
send_stop_signal
|
send_stop_signal
|
||||||
|
@ -42,6 +37,14 @@ module AbfWorker::ModelHelper
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy_from_resque_queue
|
||||||
|
Resque::Job.destroy(
|
||||||
|
worker_queue_with_priority,
|
||||||
|
worker_queue_class,
|
||||||
|
abf_worker_args
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def worker_queue_with_priority(queue = nil)
|
def worker_queue_with_priority(queue = nil)
|
||||||
queue ||= abf_worker_base_queue
|
queue ||= abf_worker_base_queue
|
||||||
queue << '_' << abf_worker_priority if abf_worker_priority.present?
|
queue << '_' << abf_worker_priority if abf_worker_priority.present?
|
||||||
|
|
Loading…
Reference in New Issue