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

This commit is contained in:
Kamil Trzcinski 2017-10-03 23:25:23 +02:00
parent f916424381
commit 7e3e8ae81b
1 changed files with 2 additions and 2 deletions

View File

@ -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