Skip to content

Commit 6478607

Browse files
committed
service discovery stop/start
1 parent 0e8d3ae commit 6478607

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/lib/routes/services.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,11 @@ def java_service_send_stop_start(host, service, endpoint)
587587
namespace_name: "merritt-#{UC3::UC3Client.stack_name}",
588588
health_status: 'HEALTHY'
589589
).instances.each do |instance|
590-
host = instance.attributes.fetch('AWS_INSTANCE_IPV4', '')
591-
resp << post_url("http://#{host}:8080/#{service}/#{endpoint}") unless host.empty?
590+
hostip = instance.attributes.fetch('AWS_INSTANCE_IPV4', '')
591+
resp << post_url("http://#{hostip}:8080/#{service}/#{endpoint}") unless hostip.empty?
592592
end
593+
# if service is not yet in ECS, use ALB address to send request to one host
594+
return post_url("#{host}/#{endpoint}") if resp.empty?
593595
resp
594596
rescue StandardError
595597
post_url("#{host}/#{endpoint}")

0 commit comments

Comments
 (0)