Skip to content

Commit 6603690

Browse files
committed
Revert "Catch error thrown if Diego Process Sync creates a desired lrp process"
Revert "Remove unnecessary logger" Revert "Rubocop fixes" This reverts commits: e321fa8. fc96bb6. 133486e.
1 parent 436370f commit 6603690

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

lib/cloud_controller/diego/desire_app_handler.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ def create_or_update_app(process, client)
66
if (existing_lrp = client.get_app(process))
77
client.update_app(process, existing_lrp)
88
else
9-
begin
10-
client.desire_app(process)
11-
rescue CloudController::Errors::ApiError => e # catch race condition if Diego Process Sync creates an LRP in the meantime
12-
if e.name == 'RunnerError' && e.message['the requested resource already exists']
13-
existing_lrp = client.get_app(process)
14-
client.update_app(process, existing_lrp)
15-
end
16-
end
9+
client.desire_app(process)
1710
end
1811
end
1912
end

spec/unit/lib/cloud_controller/diego/desire_app_handler_spec.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,6 @@ module Diego
3535
expect(client).not_to have_received(:desire_app)
3636
end
3737
end
38-
39-
context 'race condition when the Diego::ProcessesSync runs and creates a process ahead of the DesireAppHandler' do
40-
let(:desired_lrp_update) { double(:desired_lrp_update) }
41-
let(:get_app_response) { nil }
42-
43-
before do
44-
allow(client).to receive(:update_app)
45-
allow(client).to receive(:desire_app).and_raise CloudController::Errors::ApiError.new_from_details('RunnerError', 'the requested resource already exists')
46-
end
47-
48-
it 'catches the error and updates the app' do
49-
DesireAppHandler.create_or_update_app(process, client)
50-
expect(client).to have_received(:update_app)
51-
expect(client).to have_received(:get_app).exactly(2).times
52-
end
53-
end
5438
end
5539
end
5640
end

0 commit comments

Comments
 (0)