Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/cloud_controller/diego/tasks_sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ def sync
end
end

TaskModel.where(guid: tasks_to_fail).each do |cc_task|
cc_task.update(state: TaskModel::FAILED_STATE, failure_reason: BULKER_TASK_FAILURE)
unless tasks_to_fail.empty?
TaskModel.where(guid: tasks_to_fail).each do |cc_task|
cc_task.update(state: TaskModel::FAILED_STATE, failure_reason: BULKER_TASK_FAILURE)
end
end
end

Expand Down
6 changes: 6 additions & 0 deletions spec/unit/lib/cloud_controller/diego/tasks_sync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ module Diego
subject.sync
end.not_to(change { task.reload.state })
end

it 'does not query tasks with a 1=0 clause' do
expect do
subject.sync
end.to have_queried_db_times(/select \* from .tasks. where \(1 = 0\)/i, 0)
end
end

context 'when a running CC task is missing from BBS' do
Expand Down