Skip to content

Commit

Permalink
chore: fixed 5ea579f (backend_connector.js)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirrg001 committed Dec 1, 2021
1 parent ac86e36 commit ca5d100
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/serverless/src/backend_connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ let useLambdaExtension = false;

const timeoutEnvVar = 'INSTANA_TIMEOUT';
let defaultTimeout = 500;
const layerExtensionTimeout = 100;
let backendTimeout = defaultTimeout;

const proxyEnvVar = 'INSTANA_ENDPOINT_PROXY';
Expand Down Expand Up @@ -115,6 +116,10 @@ function getTransport() {
}
}

function getBackendTimeout() {
return useLambdaExtension ? layerExtensionTimeout : backendTimeout;
}

function send(resourcePath, payload, finalLambdaRequest, callback) {
if (requestHasFailed && stopSendingOnFailure) {
logger.info(
Expand Down Expand Up @@ -169,6 +174,8 @@ function send(resourcePath, payload, finalLambdaRequest, callback) {
rejectUnauthorized: !disableCaCheck
};

options.timeout = getBackendTimeout();

if (proxyAgent && !useLambdaExtension) {
options.agent = proxyAgent;
}
Expand Down

0 comments on commit ca5d100

Please sign in to comment.