Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/collector/src/announceCycle/agentHostLookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ function checkHost(host, cb) {
}
};

/** @type {import('http').ClientRequest} */
let req;

try {
/**
* TODO:
Expand Down Expand Up @@ -173,6 +175,11 @@ function checkHost(host, cb) {
}

req.on('timeout', function onTimeout() {
if (req.destroyed) {
return;
}

req.destroy();
handleCallback(
new Error(`The attempt to connect to the Instana host agent on ${host}:${agentOpts.port} has timed out`)
);
Expand All @@ -182,6 +189,11 @@ function checkHost(host, cb) {
req.setTimeout(requestTimeout);

req.on('error', err => {
if (req.destroyed) {
return;
}

req.destroy();
handleCallback(
new Error(
`The attempt to connect to the Instana host agent on ${host}:${agentOpts.port} has failed with the following ` +
Expand Down