Commit 7e3e8ae8 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Prefer to use `.tap` as `.try` hides an exceptions from workers

parent f9164243
......@@ -7,11 +7,11 @@ class WaitForClusterCreationWorker
TIMEOUT = 20.minutes
def perform(cluster_id)
Gcp::Cluster.find_by_id(cluster_id).try do |cluster|
Gcp::Cluster.find_by_id(cluster_id).tap do |cluster|
Ci::FetchGcpOperationService.new.execute(cluster) do |operation|
case operation.status
when 'RUNNING'
if TIMEOUT < Time.now - operation.start_time.to_time
if TIMEOUT < Time.zone.now - operation.start_time.to_time
return cluster.errored!("Cluster creation time exceeds timeout; #{TIMEOUT}")
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment