diff options
Diffstat (limited to 'app/workers/cluster_wait_for_ingress_ip_address_worker.rb')
-rw-r--r-- | app/workers/cluster_wait_for_ingress_ip_address_worker.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/workers/cluster_wait_for_ingress_ip_address_worker.rb b/app/workers/cluster_wait_for_ingress_ip_address_worker.rb index 829417484cf..0fbb9fb2526 100644 --- a/app/workers/cluster_wait_for_ingress_ip_address_worker.rb +++ b/app/workers/cluster_wait_for_ingress_ip_address_worker.rb @@ -4,11 +4,22 @@ class ClusterWaitForIngressIpAddressWorker include ClusterApplications INTERVAL = 10.seconds - TIMEOUT = 20.minutes def perform(app_name, app_id, retries_remaining) find_application(app_name, app_id) do |app| - Clusters::Applications::CheckIngressIpAddressService.new(app).execute(retries_remaining) + result = Clusters::Applications::CheckIngressIpAddressService.new(app).execute + retry_if_necessary(app_name, app_id, retries_remaining) unless result + end + rescue Clusters::Applications::CheckIngressIpAddressService::Error => e + retry_if_necessary(app_name, app_id, retries_remaining) + raise e + end + + private + + def retry_if_necessary(app_name, app_id, retries_remaining) + if retries_remaining > 0 + self.class.perform_in(INTERVAL, app_name, app_id, retries_remaining - 1) end end end |