Skip to content

Commit 6106a6d

Browse files
committed
fix: missing timeout in DescribeNetworkInterface call
1 parent 79f4f12 commit 6106a6d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/awsutils/awsutils.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,10 @@ func (cache *EC2InstanceMetadataCache) DescribeAllENIs(ctx context.Context) (Des
17391739
for retryCount := 0; retryCount < maxENIEC2APIRetries && len(eniIDs) > 0; retryCount++ {
17401740
input := &ec2.DescribeNetworkInterfacesInput{NetworkInterfaceIds: eniIDs}
17411741
start := time.Now()
1742-
ec2Response, err = cache.ec2SVC.DescribeNetworkInterfaces(ctx, input)
1742+
1743+
reqCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
1744+
ec2Response, err = cache.ec2SVC.DescribeNetworkInterfaces(reqCtx, input)
1745+
cancel()
17431746
prometheusmetrics.Ec2ApiReq.WithLabelValues("DescribeNetworkInterfaces").Inc()
17441747
prometheusmetrics.AwsAPILatency.WithLabelValues("DescribeNetworkInterfaces", fmt.Sprint(err != nil), awsReqStatus(err)).Observe(msSince(start))
17451748
if err == nil {

0 commit comments

Comments
 (0)