You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a logical error with the check to see if the environment is an EC2 machine. Because of this, on first run it tries to ping a non existent EC2 server which causes a delay of 30 seconds while waiting for the check to complete.
In the code snippet below, any one of the conditions will allow checking of EC2
Config.IsEc2 == null
Config.IsEc2 == true
isDefaultDeviceNameEc2
Condition 1 is checking if the variable is null - e.g. no value is set. On loading our configuration, IsEc2 is null, in which case it meets the condition and calls GetEC2InstanceId(). This call will eventually fail but require waiting for 20-30 seconds while it tries to connect to Ec2.
The condition could be written as if ((Config.IsEc2.HasValue && Config.IsEc2) || isDefaultDeviceNameEc2)
Note, that after the first run the values are cached so no further attempts at connecting with Ec2 is made.
The text was updated successfully, but these errors were encountered:
kfsit
changed the title
EnvironmentDetail.GetDeviceName check for EC2 environment wrong
EnvironmentDetail.GetDeviceName check for EC2 environment always runs
Jun 28, 2024
There is a logical error with the check to see if the environment is an EC2 machine. Because of this, on first run it tries to ping a non existent EC2 server which causes a delay of 30 seconds while waiting for the check to complete.
In the code snippet below, any one of the conditions will allow checking of EC2
Condition 1 is checking if the variable is null - e.g. no value is set. On loading our configuration, IsEc2 is null, in which case it meets the condition and calls GetEC2InstanceId(). This call will eventually fail but require waiting for 20-30 seconds while it tries to connect to Ec2.
The condition could be written as
if ((Config.IsEc2.HasValue && Config.IsEc2) || isDefaultDeviceNameEc2)
Note, that after the first run the values are cached so no further attempts at connecting with Ec2 is made.
The text was updated successfully, but these errors were encountered: